text stringlengths 10 2.61M |
|---|
module ::Logical::Naf
class Pickler
include ::Af::Application::Component
create_proxy_logger
attr_reader :preserves,
:preservables,
:naf_version,
:context
def initialize(naf_version, preservables)
@preservables = preservables
@naf_version =... |
class AddKindToCardData < ActiveRecord::Migration[5.2]
def change
add_column :card_data, :kind, :integer
add_index :card_data, :kind
end
end
|
class CardApplyTemplate < ActiveRecord::Base
enum apply_items: { all_items: 0, include_items: 1 }
APPLY_ITEMS_TITLES = {"all_items" => "所有商品", "include_items" => "指定商品" }
has_many :cards, dependent: :nullify
has_many :card_template_items, autosave: true, inverse_of: :card_apply_template, dependent: :destroy
... |
#! /usr/local/bin/ruby -w
require 'RMagick'
require 'test/unit'
require 'test/unit/ui/console/testrunner' if !RUBY_VERSION[/^1\.9|^2/]
puts RUBY_VERSION
puts RUBY_VERSION.class
module Test
module Unit
class TestCase
alias :_old_run_ :run
def run(result, &blk)
metho... |
# frozen_string_literal: true
module MLBStatsAPI
class Team < Base
def id = @data['id']
def name = @data['teamName']
def location = @data['locationName']
def abbreviation = @data['abbreviation']
alias code abbreviation
def file_code = @data['fileCode']
def short_name = @data['shortNa... |
class AddReferencesToArticles < ActiveRecord::Migration
def change
add_column :articles, :user_id, :uuid, null: false
add_index :articles, :user_id
end
end
|
module Jsonapi
class RoundResource < JSONAPI::Resource
attributes :created_at
has_one :course
has_many :scorecards
has_many :users
filter :user_id, apply: lambda { |records, value, _options|
records.joins(:scorecards).where(scorecards: { user_id: value.first })
}
filter :course_id... |
require 'rails_helper'
RSpec.describe Reservation, type: :model do
let(:jersey_city) { Location.create(name: 'Jersey City') }
let(:user1) { User.create(name: 'Marc', email: 'marc@marc.com', password: "marcmarc", location: jersey_city) }
let(:chainsaw) { ToolType.create(name: 'Chainsaw') }
let(:item... |
#!/usr/bin/env ruby
module RootTesting
module_function
def run_all_with_coverage
with_coverage do
RootTesting.run_rubocop
RootTesting.run_eslint
RootTesting.run_rspec
end
end
def run_rubocop
require "rubocop"
require "benchmark"
cli = RuboCop::CLI.new
result = 0
... |
class PersonalQuestionResponse < ActiveRecord::Base
belongs_to :personal_question_answer
belongs_to :personal_profile
has_one :personal_question, through: :personal_question_answer
end
|
require_relative "airport.rb"
class Plane
DEFAULT_STATUS = :flying
def initialize (status_init = DEFAULT_STATUS)
if status_init == :landed || status_init == :flying
@status = status_init
else
@status = DEFAULT_STATUS
end
end
def status
@status
end
def flying?
@status == :flying
end
def lan... |
FactoryBot.define do
factory :account, class: Account do
icon_image {"test.jpg"}
background_image {"test.jpg"}
introduction {"よろしく"}
end
factory :not_account, class: Account do
end
end
|
module Combinar
class EchonestArtist < Artist
def initialize(hash)
@hash = hash
end
def name
@hash['name']
end
def mbids
return [] unless @hash['foreign_ids']
[@hash['foreign_ids'].first['foreign_id'].split(':').last]
end
def id
@hash['id']
end
end
en... |
class AddAwaitingConfirmToSubRequests < ActiveRecord::Migration[5.1]
def change
add_column :sub_requests, :awaiting_confirm, :boolean, default: false
end
end
|
json.array! @pics do |pic|
json.partial! 'pic', pic: pic
end
|
module DromedaryInitializer
def self.run
if cucumber_not_initialized?
report_no_cucumber_found
elsif already_initialized?
report_already_initialized
else
create_directory 'config'
create_file 'config/dromedary.yml'
create_file 'features/support/dromedary_hooks.rb'
creat... |
require 'spec_helper'
describe ExternalLinkHelper do
let(:user) { build(:user) }
describe '#link_to_github' do
it 'generates the link' do
user = build(:user, github: 'giddiup')
expect(helper.link_to_github(user)).to eql('<a title="giddiup" href="https://github.com/giddiup">giddiup</a>')
end
... |
class News < ActiveRecord::Base
attr_accessible :name, :h1, :keywords, :description, :page, :tag, :news_type, :posted_on, :news_source_url, :news_source_name
has_many :newspictures, :dependent => :destroy, :inverse_of => :news
has_many :newsvideos, :dependent => :destroy, :inverse_of => :news
attr_accessible :n... |
# frozen_string_literal: true
RSpec.describe MondialRelay::Request do
let(:request) { build(:request) }
describe '#attributes' do
subject { request.attributes }
it 'has an xmlns attribute' do
expect(subject).to include(:xmlns)
end
end
describe '#message' do
subject { request.message }
... |
# frozen_string_literal: true
require 'spec_helper'
describe Interview::First do
let(:source_array) { [1, 7, 8, 4, 5, 6, 1, 2, 9, 11] }
let(:up_array) { [[1, 7, 8], [4, 5, 6], [1, 2, 9, 11]] }
let(:down_array) { [[1], [7], [8, 4], [5], [6, 1], [2], [9], [11]] }
describe '.array_to_up' do
specify 'Should ... |
module CassandraObject
module Timestamps
extend ActiveSupport::Concern
included do
attribute :created_at, type: :time
attribute :updated_at, type: :time
before_create do
if self.class.timestamps
self.created_at ||= Time.current
self.updated_at ||= Time.current
... |
class SidekiqWorker
include Sidekiq::Worker
def perform(job_id)
start_time = Time.now
job = Job.find job_id
job.process(start_time)
end
end
|
# frozen_string_literal: true
require 'rails_helper'
describe 'フロント画面:アカウント作成', type: :system do
context 'ログインしているとき' do
before do
sign_in_as(login_user)
visit new_company_user_path(login_user.company)
end
context '権限が not_grader のとき' do
let(:login_user) { FactoryBot.create(:user, :no... |
class Argument
private
@command = ""
@original = ""
@parameters = []
public
def initialize original = ""
@original = original
end
def set_original original = ""
@original = original
end
def set_command command = ""
@command = command
end
def set_paramet... |
require 'spec_helper'
include SplitIoClient::Cache::Adapters
describe SplitIoClient::Cache::Repositories::Impressions::MemoryRepository do
let(:config) { SplitIoClient::SplitConfig.new(impressions_queue_size: 5) }
let(:adapter) { MemoryAdapter.new(MemoryAdapters::QueueAdapter.new(3)) }
let(:repository) { descri... |
if Rails.env == "development" && Documentation.count == 0
model = Model.includes(:category).where(category: {name: "Laptop"}).first
Documentation.create({
title: "About a Laptop Brand",
documentable: model,
body: "This is an article about a laptop brand",
company: Company.first
})
end
|
# -*- encoding : utf-8 -*-
class AddRememberTokenToUsers < ActiveRecord::Migration
def up
add_column :users, :remember_token, :string
add_index :users, :remember_token, unique: true
end
def down
remove_index :users, :remember_token
remove_column :users, :remember_token
end
end
|
class QuestionsController < ApplicationController
layout :choose_layout
# This is needed so that google can access the KML file
# without a username and password
before_filter :login_required_except_kml
# before_filter :login_required, :except => :index
before_filter :get_questions
# GET... |
=begin
You are given a list of numbers which is supplemented with positions that have to be swapped.
A colon separates numbers with positions.
Positions start with 0.
You have to process positions left to right.
=end
class SwapElements
def initialize(line)
@line = line
end
def swap
base = line.split(':'... |
class AppMailer < ActionMailer::Base
def send_welcome_email(user)
@user = user
mail from: 'info@myflix.com', to: user.email, subject: "Welcome to MyFlix!"
end
def send_forgot_password(user)
@user = user
mail from: 'info@myflix.com', to: user.email, subject: "Password reset: MyFlix"
end
def s... |
require "lolita/version"
module Lolita
CONFIGURATIONS = {}
DEFAULT_CONFIGURATION_NAME = :default
def self.configuration name = nil
name ||= DEFAULT_CONFIGURATION_NAME
CONFIGURATIONS[name] ||= Lolita::SystemConfiguration::Base.new(name)
CONFIGURATIONS[name]
end
def self.setup
self.run(:befo... |
# Class based on order model created in Agile web development C.12
class Order < ActiveRecord::Base
has_many :line_items, :dependent => :destroy
# setting up an association with the customer, to give us access
# to the attributes stored in the customers table
# in order to pre-populate the order form
belong... |
class Teacher < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
has_many :teachers_project_memberships
has_many :... |
require "dotenv"
require "httparty"
class Landsat
include HTTParty
base_uri "earthexplorer.usgs.gov/inventory/json/v/latest"
def initialize(api_key = nil)
@options = { query: { jsonRequest: {} } }
api_key.nil? ? @api_key = get_api_key : @api_key = api_key
end
def search(search_options)
raise A... |
class Cart < ActiveRecord::Base
belongs_to :promotion
belongs_to :user
belongs_to :cupon
has_many :plate_cart_connections
has_many :plates, :through => :plate_cart_connections
has_many :truck_cart_connections
has_many :trucks, :through => :truck_cart_connections
scope :finished, -> { where(status: "f... |
module CloudCapacitor
class Result
attr_accessor :raw_value, :raw_cpu, :raw_mem, :requests, :errors
attr_accessor :sla, :low_deviation, :medium_deviation
def initialize(value:, cpu:, mem:, requests:1, errors:0)
@raw_value = value
@raw_cpu = cpu
@raw_mem = mem
@requests = re... |
# frozen_string_literal: true
class Types::SeriesType < Types::BaseObject
include Rails.application.routes.url_helpers
field :id, ID, null: false
field :name, String, null: false
field :resources, Types::ResourceType.connection_type, null: false
field :banner_url, String, null: true
field :foreground_url,... |
#!/usr/bin/env ruby
require 'defaultDriver.rb'
endpoint_url = ARGV.shift
obj = UpdateRecordwsdlPortType.new(endpoint_url)
# run ruby with -d to see SOAP wiredumps.
obj.wiredump_dev = STDERR if $DEBUG
# SYNOPSIS
# updateRecord(apiuser, apikey, zonename, id, name, aux, data, ttl, ddns_enabled)
#
# ARGS
# apiuser ... |
require "rails_helper"
RSpec.describe CollectiblesController, :type => :routing do
describe "routing" do
it "routes to #show with a slug" do
expect(:get => "/collectibles/1/foo").to route_to("comments#index")
end
end
end |
require 'test_helper'
class ArticlesDeletionTest < ActionDispatch::IntegrationTest
setup do
@author = authors :sample_author
@other_author = authors :other_author
@non_author = users :michael
@article = articles :sample_article
end
test 'attempt to delete an article as an anonymous user' do
... |
require 'test_helper'
class ResponseTest < ActiveSupport::TestCase
include Devise::Test::IntegrationHelpers
# def setup
# @user = User.create(email: 'adam@instructor.com', password: 'password', password_confirmation: 'password', first_name: 'Adam', last_name: 'Braus', instructor: true, student: false)
# @... |
require 'test_helper'
# Test para el Controlador Evaluaciones
class EvaluacionsControllerTest < ActionController::TestCase
setup do
@evaluacion = evaluacions(:one)
end
test 'should get index' do
get :index
assert_response :success
assert_not_nil assigns(:evaluacions)
end
test 'should get ne... |
class Song
attr_reader :name,:artist,:genre
@@count = 0
@@artists = []
@@genres =[]
def initialize(name,artist,genre)
@name=name
@artist=artist
@genre = genre
@@count +=1
@@artists << artist
@@genres << genre
end ... |
require 'test_helper'
class PasswordCreationTest < ActionDispatch::IntegrationTest
def test_textarea_has_safeties
get new_password_path
assert_response :success
# Validate some elements
text_area = css_select 'textarea#password_payload.form-control'
assert text_area.attribute('spellcheck')
... |
Rails.application.routes.draw do
root to: 'entries#index'
get '/blogroll', to: 'bloggers#index'
get '/about', to: 'static#about'
resources :semesters, :param => :slug, only: [:index, :show]
get '/:slug', to: 'entries#show'
end
|
# Convert DOIs to html. This *will not match all DOIs*. The regex comes from
# https://www.crossref.org/blog/dois-and-matching-regular-expressions/
# this may conflict with some CSLs that insert `https://doi.org/` or the like.
module Jekyll
class Scholar
class DOILinks < BibTeX::Filter
DOI_FILTER = Regexp.... |
require 'pry'
module Hand
attr_reader :name
attr_accessor :cards, :total
def initialize(name)
@name = name
@cards = []
end
def hit(deck)
cards << deck.current_deck.delete(deck.current_deck.sample)
end
def busted?
@total > 21
end
def calculate_total
copy_hand = cards.dup
con... |
# == Schema Information
# Schema version: 20090906153511
#
# Table name: user_team_drivers
#
# id :integer not null, primary key
# user_id :integer
# driver_id :integer
# created_at :datetime
# updated_at :datetime
#
require 'test_helper'
class UserTeamDriverTest < ActiveSupport::TestCase
d... |
require File.expand_path('../support/helpers', __FILE__)
describe_recipe 'docker_test::image_lwrp_test' do
include Helpers::DockerTest
it 'has docker-test-image image not installed' do
refute image_exists?('docker-test-image')
end
it 'has busybox image installed' do
assert image_exists?('busybox')
... |
class UserMailer < ApplicationMailer
default from: "kathy@webwitchdev.com"
def welcome_email(user)
@user = user
mail(to: @user.email, subject: 'Welcome to WebWitchDev')
end
end
|
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
# "development" gems in gemspec are required for testing, gems in the
# development group here are for documentation
gemspec development_group: :test
# Frameworks
gem "rack"
# Persistence
gem "mongo", "~> 2.1"
gem "redis", ... |
require 'securerandom'
class Sponsor < ApplicationRecord
before_validation :set_registration_password, :on => :create
has_many :sponsor_users
has_many :sponsor_tasks, :dependent => :destroy
has_many :tasks, :through => :sponsor_tasks
has_many :pledges, :dependent => :destroy
validates :name, :presence => tr... |
Given /^Im simple user$/ do
current_user = nil
end
Then /^I should see the page titled "(.+)"$/ do |title|
within('head title') do
page.should have_content(title)
end
end
Then /^I should see the user menu$/ do
find('#user_menu')
end
Then /^I should see in user menu link "(.*)"$/ do |menu_link|
find_... |
# == Schema Information
#
# Table name: books
#
# id :integer not null, primary key
# title :text
# author :text
# cover :string
# amazon :text
# donator_id :integer
# borrowed :boolean
# created_at :datetime not null
# updated_at :datetime not null
#
class... |
# frozen_string_literal: true
require 'hashie/mash'
module GQLi
# Response object wrapper
class Response
attr_reader :data, :errors, :query
def initialize(data, errors, query)
@data = Hashie::Mash.new(data)
@errors = parse_errors(errors)
@query = query
end
private
# Accept... |
class CampusCrimeTotalsController < ApplicationController
before_action :set_campus_crime_total, only: [:show, :edit, :update, :destroy]
# GET /campus_crime_totals
# GET /campus_crime_totals.json
def index
@campus_crime_totals = CampusCrimeTotal.all
end
# GET /campus_crime_totals/1
# GET /campus_cri... |
require ("minitest/autorun")
require_relative("./lab_work_part3.rb")
class TestLibrary < MiniTest::Test
def setup
@books = [{
title: "Lord of the Rings",
rental_details: {
student_name: "Ian Tennyson",
date: "16/01/2017"
}
},
{
title: "Harry Potter",
rental_details: {... |
module Mutations
# class Login
#
class Login < BaseMutation
argument :email, String, required: true
argument :password, String, required: true
type Types::UserType
def resolve(email:, password:)
user = User.find_for_authentication(email: email)
return nil if !user
is_valid_for... |
class SitemapController < ActionController::Base
def index
respond_to do |format|
format.xml do
now = Time.now
@objects = Obj.where(:_path, :starts_with, homepage.path)
.and_not(:_obj_class, :equals, excluded_obj_classes)
.and(:_valid_from, :is_less_than, now.to_iso)
... |
module Likeable
extend ActiveSupport::Concern
included do
has_many :likes, as: :likeable, counter_cache: true, dependent: :destroy
end
def liker_ids
likes.pluck(:creator_id)
end
#################### SEED FUNCS
def like_by(creator)
like = likes.create(creator_id: creator.id)
if like
... |
# Set up autoload of patches
require 'dispatcher' unless Rails::VERSION::MAJOR >= 3
def apply_patch(&block)
if Rails::VERSION::MAJOR >= 3
ActionDispatch::Callbacks.to_prepare(&block)
else
Dispatcher.to_prepare(:redmine_git_hosting_patches, &block)
end
end
apply_patch do
## Redmine dependencies
# req... |
require 'rails_helper'
RSpec.describe SmmsController, type: :controller do
describe '#http' do
context 'invalid payload' do
it 'returns :bad_request' do
@request.headers['Authorization'] = 'SMMS a b'
post 'http', body: ''
expect(response).to have_http_status(:bad_request)
end
... |
# frozen_string_literal: true
RSpec.describe 'Checkin Request', type: :request do
include_context 'with user token'
include_context 'with user membership'
include_context 'with json response'
include_context 'with event'
include_context 'with branch location'
include_context 'with character'
subject(:ch... |
class Tournaments::InvitesController < ApplicationController
before_action :authenticate_user!
before_action :find_invite_for_tournament, :only => [:show, :update]
before_action :find_tournament, :only => [:new, :create]
layout 'tournament_title', :only => [:new, :create]
def show
end
def update
if... |
class CreateNotices < ActiveRecord::Migration[5.1]
def change
create_table :notices do |t|
t.references :user, foreign_key: true
t.references :kind, polymorphic: true, index: true
t.integer :unread_count, default: 1
t.timestamps
end
add_index :notices, [:user_id... |
class Lawyer
attr_reader :name, :own_cases, :law_firm, :permissions
def initialize(name, law_firm)
@permissions = PermissionCollection.new
@name = name
@law_firm = law_firm
@own_cases = []
end
def init_case(number)
law_case = LawCase.new(number, self)
@own_cases << law_case
law_cas... |
control "M-7.1" do
title "7.1 Ensure swarm mode is not Enabled, if not needed (Scored)"
desc "
Do not enable swarm mode on a docker engine instance unless needed.
By default, a Docker engine instance will not listen on any network ports,
with all
communications with the client coming over the Unix sock... |
class AddCodperSerie < ActiveRecord::Migration
def self.up
add_column :series, :codperiodo, :integer, :null => false
end
def self.down
remove_column :series, :codperiodo
end
end
|
class Image < ApplicationRecord
belongs_to :parent, polymorphic: true
has_attached_file :image, styles: { origianl: [:png] }, default_url: "/images/:style/missing.png"
validates_attachment_presence :image
validates_attachment_content_type :image, content_type: /\Aimage\/.*\z/
def image_url
self.image.ur... |
class FixProductsDesription < ActiveRecord::Migration
def up
rename_column :products, :desctiption, :description
end
def down
rename_column :products, :description, :desctiption
end
end
|
class Movie < ActiveRecord::Base
def released_1930_or_later
errors.add(:release_date, "must be 1930 or later") if self.release_date < Date.parse("1 Jan 1930")
end
def grandfathered?
self.release_date >= Date.parse("1 Nov 1967")
end
def self.find_with_same_director(movie)
where("id <> :id AN... |
class AddIndexToCard < ActiveRecord::Migration[5.2]
def change
add_index :cards, [:e_no, :s_no, :result_no, :generate_no], :unique => false, :name => 'resultno_and_eno'
add_index :cards, :name
add_index :cards, :possession
add_index :cards, :kind
add_index :cards, :card_id
end
end
|
class SeparateEditorialFromBooks < ActiveRecord::Migration
def change
create_table :editorials do |t|
t.string :name, null: false, index: true
t.timestamps
end
end
def data
# creates the attribute to associate models
add_column :books, :editorial_id, :integer
# renames the event ... |
class CreatePayments < ActiveRecord::Migration
def change
create_table :payments do |t|
t.text :comment
t.integer :day
t.string :state, default: 'Enviado'
t.references :user, index: true
t.timestamps
end
add_attachment :payments, :image
end
end
|
class Person < ApplicationRecord
belongs_to :user
TYPE_IDENTIFICATION_OPTIONS = [ "C", "E"]
end
|
ToauthConnect.configuration do |config|
config.client_id = "8839f633b7a3b3e32289f3517956291a4efa53c87e490cb1a687d4f13937204a" #ID de Cliente gerado no Toauth
config.client_secret = "35cf4213eb43bfe796be89e6d5742a63a8bee264d619a90548ab320f35b1b567" #Chave secreta gerada no Toauth
config.domain_default = "http:/... |
class CreatePartyAs < ActiveRecord::Migration
def change
create_table :party_as do |t|
t.string :city
t.string :company
t.timestamps null: false
end
end
end
|
class Game
attr_reader :players
def initialize(p1, p2)
@players = [p1, p2]
end
def attack(player)
player.is_attacked
end
end
|
# Microbenchmark to test the performance of respond_to?
# This is one of the top most called methods in rack/railsbench
require 'harness'
class A
def foo
end
def foo2
end
end
class B < A
end
class C < A
end
run_benchmark(50) do
a = A.new
b = B.new
c = C.new
# 500K calls
500000... |
class Edge < ActiveRecord::Base
belongs_to :source, :class_name => "Node", :foreign_key => "source_id"
belongs_to :sink, :class_name => "Node", :foreign_key => "sink_id"
belongs_to :edge_type
validates_presence_of :source_id
validates_presence_of :sink_id
validates_presence_of :edge_type_id
def source_... |
class CreateClientes < ActiveRecord::Migration
def change
create_table :clientes do |t|
t.string :nombre, :limit => 50, :null => true
t.string :direccion, :limit => 100, :null => true
t.string :provincia, :limit => 50, :null => true
t.string :localidad, :limit => 100, :nul... |
def reduce(arr, start = 0)
memo = start
counter = 0
while counter < arr.size
memo = yield(memo, arr[counter])
counter += 1
end
memo
end
array = [1, 2, 3, 4, 5]
p reduce(array) { |acc, num| acc + num } # => 15
p reduce(array, 10) { |acc, num| acc + num } # => 25
p r... |
class AdminUser < ApplicationRecord
belongs_to :user, autosave: true
validates :name, presence: true
validates :last_name, presence: true
validates :email, presence: true, format: { with: URI::MailTo::EMAIL_REGEXP }
validates :user, presence: true, uniqueness: true
before_validation :default_values
pri... |
class Company < ActiveRecord::Base
has_many :birthday_deals
has_many :company_locations
has_many :contacts
accepts_nested_attributes_for :contacts
# attr_accessible :archived, :city, :image, :image_cache, :name, :phone, :postal_code, :state, :street1, :street2, :url
validates :name, presence: true
mo... |
require 'rails_helper'
RSpec.describe SupplyTeachers::BranchesController, type: :controller do
describe 'GET index' do
let(:first_branch) { create(:supply_teachers_branch) }
let(:second_branch) { create(:supply_teachers_branch) }
let(:branches) { [first_branch, second_branch] }
context 'when not log... |
class AddClassNumberToCourse < ActiveRecord::Migration[6.0]
def change
add_column :courses, :class_number, :string
end
end
|
class Pet < ActiveRecord::Base
belongs_to :shelter
belongs_to :user
validates :name, format: { without: /[0-9]/, message: "does not allow numbers" }
validates :pet_type, format: { without: /[0-9]/, message: "does not allow numbers" }
validates :breed, format: { without: /[0-9]/, message: "does not ... |
module AppProxy
class MobileNumberStorersController < ApplicationController
include ShopifyApp::AppProxyVerification
include HTTParty
protect_from_forgery
#before_action :set_mobile_number_storer, only: [:show, :edit, :update, :destroy, :update_mobile_number]
# GET /mobile_number_storers
# GET /mob... |
require 'test_helper'
class ContentItemTest < ActiveSupport::TestCase
def setup
@content_item = content_items(:Post1)
@user = users(:Dave)
end
test "content_item created" do
assert_equal(@content_item.title, "Title1", "title not set correctly")
assert_equal(@content_it... |
require 'spec_helper'
describe MangaEdenRipper::Page, vcr: true do
subject(:page) do
MangaEdenRipper::Page.new image_path: image_path, number: number
end
let(:image_path) do
'09/0931adc01475599dbdf42d92b80430aa22619192148ee9def6b66aad.png'
end
let(:number) { 12 }
let(:example_image_url) do
'... |
module Omega
class Text
attr_accessor :position, :scale, :text, :color, :mode
def initialize(path, size)
@@fonts ||= {}
change_font(path, size)
@position = Omega::Vector3.new(0, 0, 0)
@scale = Omega::Vector2.new(1, 1)
@text = ""
... |
FactoryGirl.define do
sequence :email do |n|
"person#{n}@example.com"
end
factory :user do
name 'Igor Wspaniały - admin'
password '123456'
email { generate :email }
locale 'pl'
roles_mask 1
end
end
|
require 'spec_helper'
require 'capybara/rails'
require 'capybara/rspec'
describe '' do
describe 'the person view', type: :feature do
let(:person) { Fabricate :person }
let(:user) { person.user }
before(:each) do
person.phone_numbers.create(number: "555-1234")
person.phone_numbers.create(number: "555-5... |
#Fedena
#Copyright 2011 Foradian Technologies Private Limited
#
#This product includes software developed at
#Project Fedena - http://www.projectfedena.org/
#
#Licensed under the Apache License, Version 2.0 (the "License");
#you may not use this file except in compliance with the License.
#You may obtain a copy of the ... |
# Happy Parrot - This parrot is so happy. It accepts a 'thing' as its argument and then returns a string where it says how happy it is about the thing!
def happy_parrot(thing)
"I am so happy about #{thing}!"
end
happy = happy_parrot("waffles")
# Boring Parrot - Write a method for a boring parrot that just returns ... |
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe GuildMember, type: :model do
it { should validate_presence_of(:user) }
it { should validate_presence_of(:guild) }
it { should allow_values('member', 'officer', 'owner').for(:rank) }
it { should belong_to(:user) }
it { should belong_to(:guil... |
Vagrant.configure("2") do |config|
unless Vagrant.has_plugin?("vagrant-vbguest")
puts "Vagrant plugin `vagrant-vbguest` is not installed. Please follow the instructions from concent-deployment README."
abort
end
config.vm.box = "debian/stretch64"
config.vm.hostname = "concent-deve... |
require 'rubygems'
require 'rake'
begin
require 'jeweler'
Jeweler::Tasks.new do |gem|
gem.name = "safe"
gem.summary = %Q{Backup filesystem and MySQL to Amazon S3 (with encryption)}
gem.description = "Simple tool to backup MySQL databases and filesystem locally or to Amazon S3 (with optional encryption)... |
Rails.application.routes.draw do
resources :posts, only: %i[index show new create edit update]
get '/posts/:id/edit', to: 'posts#edit'
patch '/posts/:id', to: 'posts#update'
end
|
#encoding: utf-8
require 'rubygems'
require 'rake'
require 'active_record/fixtures'
require 'uuidtools'
require 'colorize'
namespace :seek do
#these are the tasks required for this version upgrade
task :upgrade_version_tasks=>[
:environment,
:resynchronise_assay_types,
:resync... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.