text stringlengths 10 2.61M |
|---|
require 'spec_helper'
module Alf
describe Database, '.new' do
let(:adapter){ Adapter.new(nil) }
after do
expect(subject.adapter).to be_kind_of(Adapter)
end
context 'on a single adapter' do
subject{ Database.new(adapter) }
it 'uses the specified adapter' do
expect(subject.... |
require 'my_service_name/log'
require 'dry-container'
module MyServiceName
extend self
def dependencies(container: Dry::Container.new, eagerly_initialize: true)
# https://github.com/dry-rb/dry-container
# require 'my_dependency_here'
require 'my_service_name/interactors/add_six'
require 'my_ser... |
class VinNumbersApi < Grape::API
params do
requires :vin, type: String, desc: 'the vin number'
end
route_param :vin do
desc 'Decode an vin_number'
post do
vin_number = VinNumber.find_or_create_by_vin_number(permitted_params[:vin])
represent vin_number, with: VinNumberRepresenter
end
... |
require 'spec_helper'
def login(user)
OmniAuth.config.mock_auth[:identity] = OmniAuth::AuthHash.new({ provider: 'identity', uid: user.id })
post '/auth/identity/callback', screen_name: user.screen_name, password: 'password1'
end
describe 'Expenses' do
let(:user) { create(:user) }
let(:other_user) { create(:us... |
class AccessPolicy
include AccessGranted::Policy
def configure
role :administrator, { is_admin: true } do
can :create, Employee
can :read, Employee
can :update, Employee
can :destroy, Employee
can :create, Department
can :read, Department
can :u... |
require 'spec_helper'
describe KeywordsController do
describe 'GET #index' do
fixtures :templates
it 'returns all the keywords as JSON' do
expected = [
{ keyword: 'blah', count: 1 },
{ keyword: 'wordpress', count: 1 },
{ keyword: 'wp', count: 1 }
]
get :index, form... |
# Copyright 2010 Mark Logic, Inc.
#
# 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 License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... |
class MoveRememberTokenFromRegisteredToVerification < ActiveRecord::Migration
def change
add_column :verifications, :remember_token, :string
remove_column :registered_clubs, :remember_token
end
end
|
require 'faker'
class Post < ActiveRecord::Base
belongs_to :category
validates :secret_key, uniqueness: true
validates :title, presence: true
def self.get(params)
Post.where(title: params[:post]).first
end
def self.secret_get(params)
Post.where(secret_key: params[:secret_key]).first
end
def ... |
# frozen_string_literal: true
require 'stannum/constraints'
module Stannum::Constraints
# Namespace for Hash-specific constraints.
module Hashes
autoload :ExtraKeys,
'stannum/constraints/hashes/extra_keys'
autoload :IndifferentExtraKeys,
'stannum/constraints/hashes/indifferent_extra_keys'
... |
class CreateTrparams < ActiveRecord::Migration[5.0]
def change
create_table :trparams do |t|
t.float :pxx
t.float :pkz
t.float :snom
t.float :ukz
t.float :io
t.float :qkz
t.belongs_to :mpoint, index: true
t.timestamps
end
end
end
|
class Tag < ActiveRecord::Base
has_many :tagposts
has_many :posts, through: :tagposts
end
|
require_relative './shared_examples/display_sticky_newsletter_spec'
RSpec.describe StickyNewsletterVisibility, type: :helper do
let(:request) { double('request', url: url, base_url: base_url) }
let(:base_url) { 'http://example.com' }
describe 'whitelisted' do
context 'article' do
let(:url) { 'http://... |
class GalleryController < ApplicationController
verify :xhr => true, :only => [:on_new_photoset, :create_photo_set, :on_photo_set_item],
:add_flash => {:error => 'Invalid request!'}, :redirect_to => {:action => :index}
verify :params => :photo_set, :only => :create_photo_set,
:add_flash => {:error => 'Inv... |
class DtEmpresaRequestSerializerUser < ActiveModel::Serializer
attributes :id, :empresa, :fecha, :titulo, :estado, :DT_RowAttr, :bg_color, :state_color, :empresa_hash
def empresa
object.empresa.decorate.user_table_info
end
def empresa_hash
empresa = object.empresa.decorate
{
:id => empre... |
# in order to run the console with project environment
rails console # or
rails c
# to list all classes in models, even if they are not using ORMs
Dir['**/models/**/*.rb'].map {|f| File.basename(f, '.*').camelize.constantize }
# run server in current folder
ruby -run -e httpd . -p 9090
# create rails-api (gem rails-... |
class RewardsUser < ActiveRecord::Base
belongs_to :reward
belongs_to :user
end
|
class RenameColumnPurchaseOrderIdToOrderId < ActiveRecord::Migration
def change
rename_column :provisions, :purchase_order_id, :order_id
end
end
|
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Ch... |
require 'test_helper'
class ConsultationTypesControllerTest < ActionDispatch::IntegrationTest
setup do
@consultation_type = consultation_types(:one)
end
test "should get index" do
get consultation_types_url
assert_response :success
end
test "should get new" do
get new_consultation_type_url
... |
class Api::PurchasesController < ApiController
class UnsupportedService < PurchaseError; end
before_filter :authenticate_user_from_token!
rescue_from PurchaseError, with: :bad_request
rescue_from UnsupportedService, with: :not_found
rescue_from PurchaseEnvironmentPolicy::Error, with: :forbidden
def create... |
class Code < ActiveRecord::Base
has_many :authorships
has_many :authors, :through => :authorships
has_many :comments, :dependent => :destroy, :order => 'created_at desc'
has_many :working_comments, :class_name => 'Comment', :conditions => { :works_for_me => true }
has_many :failure_comments, :class_name => 'C... |
namespace :cache do
def foo(s)
Fyle.find_each do |f|
if f.type_negotiation == s
puts "gotcha (#{s}) #{f}"
# f.cache_file = nil
# f.save
end
end
end
desc 'remove cached files, type is: all, text, pdf, xml, html'
task :clear, [:type] => :environment do |t, args|
case args.type
when 'pdf... |
class Pub
attr_reader :name, :till
def initialize(name, till)
@name = name
@till = till
@drinks = []
end
def drink_count
return @drinks.count
end
def add_drink(drink)
@drinks << drink
end
def serve(customer, drink)
first_index_of_drink = @drinks.index(drink)
drink_is_not... |
class ChoreScheduler < ActiveRecord::Base
belongs_to :chore #the last chore it scheduled
attr_accessible :default_bids, :respawn_time
has_paper_trail
serialize :default_bids, Hash
def schedule_next(run_at_time)
old_chore = self.chore
new_chore = nil
new_auction = nil
Chore.transaction do
... |
class MessagesController < ApplicationController
before_action :authenticate_user_admin!
def create
@message = Message.new(message_params)
render plain: 'ERROR' and return unless @message.save
if user_signed_in?
ActionCable.server.broadcast(
'message_channel',
message: @message,
... |
class CreateWorkflows < ActiveRecord::Migration[5.1]
def change
create_table :workflows do |t|
t.string :open
t.string :backlog
t.string :wip
t.string :testing
t.string :done
t.string :flagged
t.integer :cycle_time
t.integer :lead_time
t.references :setting, foreign_key: true
t.timestam... |
Rails.application.routes.draw do
devise_for :users
resources :posts do
get :search, on: :collection
end
resources :comments, only: %i[create]
root 'posts#index'
end
|
$:.unshift(File.dirname(__FILE__))
require_relative 'materialize_components/badge.rb'
require_relative 'materialize_components/base.rb'
require_relative 'materialize_components/breadcrumb.rb'
require_relative 'materialize_components/button.rb'
require_relative 'materialize_components/chip.rb'
require_relative 'material... |
module ETL #:nodoc:
module Processor #:nodoc:
# Base class for pre and post processors. Subclasses must implement the +process+ method.
class Processor
def initialize(control, configuration)
@control = control
@configuration = configuration
after_initialize if respond_to?(:after... |
class TaxonUsagesController < ApplicationController
def show
@taxon_usage = TaxonUsage.new(id: params[:id])
render partial: "taxon_usage", locals: { taxon_usage: @taxon_usage }
end
end
|
class Riddle
attr_reader :riddle, :answer, :id, :name
@@riddles = {}
@@total_rows = 0
def initialize(name, riddle, answer, id)
@name = name.downcase
@riddle = riddle.downcase
@answer = answer.downcase
@id = id || @@total_rows += 1
end
def save(... |
require 'nokogiri'
require 'set'
require_relative 'lib/boss'
require_relative 'lib/factory'
require_relative 'lib/capability'
require_relative 'lib/observation'
module SOSHelper
Urls = ["http://cgis.csrsr.ncu.edu.tw:8080/swcb-sos-new/service",
"http://cgis.csrsr.ncu.edu.tw:8080/epa-sos/service",
"http://cgi... |
require 'savon'
module OCR
class Free_ocr < OCR::Ocr
attr_accessor :convert_to_bw
private
def init
super()
end
def ocr_recognize
raise Exception, 'You should set image file' unless @file
request = {
'image' => File.open(@file, 'rb') { |f| [f.read].pack... |
class PokeLocsController < ApplicationController
def search
if params[:lat].blank? || params[:lng].blank?
render json: {errors: ["lat or lng must be specify"]}, status: :bad_request
return
end
lat = params[:lat].to_f
lng = params[:lng].to_f
list = PokeLoc.current_list(lat: lat, lng: ln... |
class CreateCampsites < ActiveRecord::Migration[6.1]
def change
create_table :campsites do |t|
t.string :name
t.string :state
t.string :address
t.string :phone_number
t.string :website
t.text :description
t.boolean :full_hookups
t.boolean :partial_hookups
t.bo... |
class CreateGameScenarios < ActiveRecord::Migration
def change
create_table :game_scenarios do |t|
t.text :faces
t.text :viable_words
t.integer :max_score
end
end
end
|
class GithubsController < ApplicationController
before_action :login_github
# /githubs Get list of repositories
def index
@list = @github&.repos&.list
end
# github/id Get repo details
def show
if params["id"].present?
@project = @github&.repos&.get_by_id(param... |
namespace :today_question do
desc "Rake task to update new daily questions"
task update: :environment do
puts "#{Time.now} Updating daily questions..."
list = Question.where(author_id: 1)
numbers = (0..(list.count-1)).to_a.sample 5
numbers.each do |number|
question = list[number]
quest... |
shared_examples_for "controller_activity_logging" do
before(:all) do
sorcery_reload!([:activity_logging])
end
specify { expect(subject).to respond_to(:current_users) }
let(:user) { create_new_user }
before(:each) { user }
it "'current_users' is empty when no users are logged in" do
expect(subjec... |
require "liminal_hooks"
require "active_record/remove_validator"
module SpreeSite
class Engine < Rails::Engine
def self.activate
# Add your custom site logic here
Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
Rails.configuration.cache_classes ? require(c) : l... |
require_relative './glyphs'
module DataMetaXtra
# ANSI control sequences.
module AnsiCtl
# https://en.wikipedia.org/wiki/ANSI_escape_code
# Skip ANSI Escape sequences unless this env var is defined and set to 'yes'
SKIP_ANSI_ESC = ENV['DATAMETA_USE_ANSI_CTL'] != 'yes'
include Glyphs
# ANSI escape operation sta... |
require 'test_helper'
class CreateFactoriesTest < ActionDispatch::IntegrationTest
# test message
test " gets new sheet form and create new sheet" do
# gets new sheet path -> emulating user behaviour were user selet the option to create a new record
get new_factory_path
# assert whether we have ... |
require 'rails_helper'
describe "nav system" do
it 'goes to the root path when clicking the logo' do
visit trips_path
click_on "BikeShare"
expect(current_path).to eq(root_path)
end
it 'redirects to stations index when you click on Stations' do
visit root_path
click_on "Stations"
e... |
class RemoveTranscriptionFromVoicemails < ActiveRecord::Migration[5.2]
def change
remove_column :voicemails, :transcription, :text
end
end
|
# The Vehicle model
class Vehicle < ApplicationRecord
validates :name, :desc, :state_id, presence: true
belongs_to :state
before_validation :set_default_state, on: :create
delegate :name, to: :state, prefix: true
def as_json(options = {})
super(options.merge(methods: [:state_name]))
end
def next_... |
=begin
Create an array with the following values: 3,5,1,2,7,9,8,13,25,32. Print the sum of all numbers in the array. Also have the function return an array that only include numbers that are greater than 10 (e.g. when you pass the array above, it should return an array with the values of 13,25,32 - hint: use reject or ... |
class LeaguePresenter < BasePresenter
presents :league
def to_s
league.name
end
def link
link_to league.name, league_path(league)
end
def description
# rubocop:disable Rails/OutputSafety
league.description_render_cache.html_safe
# rubocop:enable Rails/OutputSafety
end
def list_gr... |
# encoding: utf-8
module Kinopoisk
class Movie
require 'open-uri'
require 'nokogiri'
attr_accessor :id, :url
HEADERS = { "Accept" => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
"Accept-Language" => 'ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4',
'Host' ... |
module Twigg
# Class which computes an approximation of the Flesch Reading Ease metric for
# a given piece of English-language text.
#
# @see {http://en.wikipedia.org/wiki/Flesch%E2%80%93Kincaid_readability_tests}
class Flesch
def initialize(string)
@string = string
end
def reading_ease
... |
class Message < ActiveRecord::Base
attr_accessible :body
after_create :notify
private
def notify
Notification.create(event: "New Notification")
end
end
|
class TwilioAdapter
def initialize
@client = Twilio::REST::Client.new
end
def lookup(phone_number)
number = phone_number.delete("^0-9")
result = client.lookups.phone_numbers(number).fetch
LookupResult.new(phone_number: result.phone_number)
rescue Twilio::REST::RestError
LookupResult.new(pho... |
require_relative "welcome_menu"
require_relative "../data/order_handler"
require_relative "../data/product_handler"
require_relative "../data/database_handler"
require "Date"
#Menu which presents financial information to the user.
module FinancialMenu
#Shows financial main menu in the console.
def FinancialMenu.sh... |
# == Schema Information
#
# Table name: students
#
# id :integer not null, primary key
# email :string
# first_name :string
# graduation_year :integer
# last_name :string
# created_at :datetime not null
# updated_at :datetime not null
#
descr... |
# frozen_string_literal: true
# rubocop:todo all
shared_examples 'message with a header' do
let(:collection_name) { 'test' }
describe 'header' do
describe 'length' do
let(:field) { bytes.to_s[0..3] }
it 'serializes the length' do
expect(field).to be_int32(bytes.length)
end
end
... |
class SurveyTungsController < ApplicationController
# GET /survey_tungs
# GET /survey_tungs.xml
def index
@survey_tungs = SurveyTung.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @survey_tungs }
end
end
# GET /survey_tungs/1
# GET /survey_tung... |
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::Config::Sections::List do
describe '#fields_for_table' do
subject { RailsAdmin.config(Player).list }
it 'brings sticky fields first' do
RailsAdmin.config Player do
list do
field(:number)
field(:... |
require "helpers/integration_test_helper"
require "integration/factories/images_factory"
class TestImages < FogIntegrationTest
include TestCollection
def setup
@subject = Fog::Compute[:google].images
@factory = ImagesFactory.new(namespaced_name)
end
def test_get_specific_image
image = @subject.ge... |
class ConsumersController < ApplicationController
skip_before_filter :verify_authenticity_token
before_filter :authenticate!
respond_to :json
def index
# TODO: Refactor hacky code
if params[:producer_id]
producer_id = params[:producer_id]
producer = Producer.find(producer_id)
return ... |
# Number letter counts
# Problem 17
# If the numbers 1 to 5 are written out in words: one, two, three, four, five,
# then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total.
# If all the numbers from 1 to 1000 (one thousand) inclusive were written out
# in words, how many letters would be used?
# NOTE: Do not co... |
module Kuhsaft
class PublishState
extend ActiveModel::Translation
UNPUBLISHED = 0
PUBLISHED = 1
PUBLISHED_AT = 2
attr_reader :name
attr_reader :value
def initialize(options)
options.each_pair { |k, v| instance_variable_set("@#{k}", v) if respond_to?(k) }
end
def self.all
... |
class Sellers::DashboardController < ApplicationController
def show
@seller = Seller.find_by(slug: params[:slug])
end
end
|
class AddDeletedAtToUsers < ActiveRecord::Migration
def change
add_column :users, :deleted_at, :datetime
add_column :users, :archive, :integer
add_index :users, :archive
end
end
|
class Admin::AdminSettingController < AdminAreaController
def index
@new_organization = Organization.new
end
def add_organization
if !params[:organization][:name].present?
flash[:alert] = "Invalid organization name"
else
@new_organization = Organization.new(org_params)
@new_organiz... |
#!/usr/bin/env ruby
# encoding: utf-8
# File: version.rb
# Created: 23/05/2014
#
# (c) Michel Demazure <michel@demazure.com>
# production de rapports pour Jacinthe
module JacintheReports
# access methods for Jacinthe
module Jaccess
VERSION = '1.2.7'
end
end
|
class CreateSimCards < ActiveRecord::Migration
def self.up
create_table :sim_cards do |t|
t.integer :sim_card_provider_id
t.string :sim_number
t.boolean :auto_order_card
t.integer :sip_account_id
t.string :auth_key
t.string :state
t.text :log
t.timestamps
end
... |
module IControl::LocalLB
##
# The ProfileFTP interface enables you to manipulate a local load balancer's FTP profile.
class ProfileFTP < IControl::Base
set_id_name "profile_names"
class ProfileFTPStatisticEntry < IControl::Base::Struct; end
class ProfileFTPStatistics < IControl::Base::Struct; end
... |
require 'rails_helper'
RSpec.feature "Adding Comments" do
before do
@johndoe = User.create(:email =>"johndoe@gmail.com", :password => "password@123")
@fred = User.create(:email =>"fred@gmail.com", :password => "password@123")
@article = Article.create!(title: "Title one", body: "Body o... |
# -*- coding: utf-8 -*-
# localeの設定
execute "setting locale" do
command "localedef -f UTF-8 -i ja_JP ja_JP"
not_if "locale | grep ja_JP.UTF-8"
end
template "/etc/sysconfig/i18n" do
owner 'root'
group 'root'
mode "0644"
end
|
git "nosy" do
repository "https://github.com/wkral/Nosy.git"
reference "master"
destination File.join(node.base.home_dir, node.nosy.dir)
action :sync
user node.base.user
group node.base.group
end
template File.join(node.base.home_dir, "bin/nosy") do
owner node.base.user
group node.base.... |
class Booking < ApplicationRecord
belongs_to :user
belongs_to :product
# validations
validates :user, :product, :time, :status, presence: true
end
|
Rails.application.routes.draw do
root 'tweets#index'
resources :tweets do
resources :comments, only: %i[new edit update create destroy]
end
devise_for :users
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
end
|
class Agent < ActiveRecord::Base
has_one :account, as: :accountable, dependent: :destroy
belongs_to :company
has_many :sent_messages, :as => :sender, :class_name => 'Message'
has_many :received_messages, :as => :receiver, :class_name => 'Message'
end
|
require 'rails_helper'
RSpec.describe RatingsController, :type => :controller do
let(:valid_attributes) {
attributes_with_foreign_keys(:rating)
}
let(:invalid_attributes) {
attributes_for(:invalid_rating)
}
context 'unauthenticated' do
it 'redirects to sign in page when unauthenticated' do
... |
# 10/10/13 DH: Let's Monkey-patch the baby...it's a Ruby thing... :)
Spree::AppConfiguration.class_eval do
#preference :use_store_credit_minimum, :float, :default => 0.0
preference :pencil_pleat_multiple, :float
preference :deep_pencil_pleat_multiple, :float
preference :double_pleat_multiple, :float
prefere... |
class User < ActiveRecord::Base
include NeoNode
attr_accessible :password, :password_confirmation, :name
attr_accessor :password, :password_confirmation
has_many :emails, :conditions => {:verification_code => nil}, :dependent => :destroy
has_many :emails_to_verify, :class_name => "Email", :foreign_key => ... |
# frozen_string_literal: true
module Dynflow
module Utils
# Heavily inspired by rubyworks/pqueue
class PriorityQueue
def initialize(&block) # :yields: a, b
@backing_store = []
@comparator = block || :<=>.to_proc
end
def size
@backing_store.size
end
def t... |
class Customer
attr_reader :name
def initialize(name)
@name = name
@books = []
end
def add_book_to_customer(book)
@books << book
end
def customer_book_count
return @books.count
end
end
|
# == Schema Information
#
# Table name: people
#
# id :integer not null, primary key
# full_name :string(255)
# title :string(255)
# bio :text
# created_at :datetime not null
# updated_at :datetime not null
#
class Person < ActiveRecord::Base
attr_accessible :bio, ... |
class CreateRelatedTransactions < ActiveRecord::Migration
def change
create_table :related_transactions do |t|
t.integer :transaction_id
t.integer :other_transaction_id
t.boolean :archived, default: false
t.timestamps
end
add_index :related_transactions, :transaction_id
add_in... |
class Neovim < Formula
desc "Ambitious Vim-fork focused on extensibility and agility"
homepage "http://neovim.io"
head "https://github.com/neovim/neovim.git"
option "without-debug", "Don't build with debInfo."
depends_on "cmake" => :build
depends_on "libtool" => :build
depends_on "automake" => :build
... |
# frozen_string_literal: true
Gem::Specification.new do |spec|
spec.name = "coda-jekyll-theme"
spec.version = "0.1.15"
spec.authors = ["Vipul Barodiya"]
spec.email = ["sonumeewa@gmail.com"]
spec.summary = "A theme for jekyll"
spec.homepage = "https://www.github.com/... |
puts "What is the hamster's name?"
hamster_name = gets.chomp
puts "What is the volume level from 1-10?"
volume = gets.to_i
puts "What is the fur color?"
fur_color = gets.chomp
puts "Is the hamster a good candidate for adoption?"
adoption = gets.chomp
puts "What is the hamster's estimated age?"
... |
# coding: utf-8
require 'spec_helper'
feature 'Create request', js: true do
let!(:cluster) { factory!(:cluster) }
let!(:project) { factory!(:project) }
scenario 'with valid data' do
sign_in project.user
visit project_path(project)
click_on 'Создать заявку'
within '.popover' do
fill_in '... |
class CreateVotations < ActiveRecord::Migration[5.0]
def change
create_table :votations do |t|
t.references :user, foreign_key: true
t.references :appointment, foreign_key: true
t.integer :result
t.boolean :access, default: false
t.timestamps
end
end
end
|
class Glslang < Formula
desc "OpenGL and OpenGL ES reference compiler for shading languages"
homepage "https://www.khronos.org/opengles/sdk/tools/Reference-Compiler/"
url "https://github.com/KhronosGroup/glslang/archive/3.0.tar.gz"
sha256 "91653d09a90440a0bc35aa490d0c44973501257577451d4c445b2df5e78d118c"
head... |
require 'spec_helper'
describe 'A product' do
fixtures :products
context 'being viewed by a search engine' do
before do
@product = products(:with_seo)
visit product_path(@product)
end
it "should contain the SEO meta description" do
within('head') do
page.should have_css("met... |
class MusicImporter
attr_accessor :file_path
def initialize(file_path)
@path = file_path
end
def path
@path
end
def files
@files = []
Dir["#{@path}/*"].each do |file|
file_name = file.split("mp3s/")[1]
@files << file_name
end
@files
end
def import
files = se... |
require 'rails_helper'
describe Product do
let(:product) {Product.create!(name: "race bike")}
let(:user) {User.create!(first_name: "Rey", last_name: "Kuizon", email: "test@gmail.com", password: "password")}
before do
product.comments.create!(rating: 1, user: user, body: "Awful bike!")
product.comments.creat... |
require 'spec_helper'
describe Yast do
it "should have a version" do
Yast.const_defined?("VERSION").should be_true
end
describe "Configuration" do
Yast::Configuration::DEFAULT_OPTIONS.each_key do |key|
it "should set the #{key}" do
Yast.configure do |config|
config.send("#{key}="... |
class BackgroundSerializer
include FastJsonapi::ObjectSerializer
attributes :background_url
end
|
class DropDreamDatesTable < ActiveRecord::Migration[6.1]
def change
drop_table :dream_dates
add_column :dreams, :date, :string
end
end
|
class MigrateUuidToVersionFive < ActiveRecord::Migration[5.0][5.0]
def change
change_table :approvals, id: :uuid do
end
end
end
|
require 'spec_helper'
describe Wildcat::Team do
it { should validate_presence_of(:name) }
it { should validate_presence_of(:nickname) }
it { should validate_presence_of(:abbreviation) }
it { should validate_presence_of(:location) }
it { should validate_presence_of(:conference) }
it { should validate_prese... |
#
# Exodus::NewSeatGenerator
#
# MT19937に基づく擬似乱数生成器を用いて席替えを行う
# シャッフルはメルセンヌツイスタに基づく擬似乱数生成器を生成して行います。
# 擬似乱数生成器のシード値は以下のフォーマットで定義するものとします。
# hhmmss (h : Hour, m : Minute, s : Second)
require 'rubygems'
require 'gtk2'
$:.unshift File.dirname(__FILE__)
module Exodus
class NewSeatGenerator
attr_accessor :name_arra... |
require 'spec_helper'
describe Estatic::Configuration do
let(:file) { File.expand_path(File.dirname(__FILE__) + '/../fixtures/file.csv') }
describe '.initialize' do
it 'should set default values if no block is given' do
configuration = described_class.new
expect(configuration.chunk).to eq(8)
... |
#require 'builder'
class PayrollResultsXmlExporter < PayrollResultsExporter
def initialize(company, department, person, person_number, payroll)
super(company, department, person, person_number, payroll)
end
def export_xml
builder = Builder::XmlMarkup.new(indent: 2)
builder.instruct! :xml, version: ... |
module ActiveRecordFiles
class Collection
attr_accessor :json_file
delegate :[], :[]=, :to_json, :push, :length, to: :json_file
def initialize(klass)
@klass = klass
@json_file = load_file(build_path(@klass))
end
def write
File.write(build_path(@klass), @json_file.to_json)
... |
Pod::Spec.new do |s|
# 简介
s.name = 'JXTAlertManager'
s.summary = 'A library easy to use UIAlertView and UIAlertViewController on iOS.'
s.authors = { 'kukumaluCN' => '1145049339@qq.com' }
s.social_media_url = 'https://www.jianshu.com/u/c8f8558a4b1d'
# 版本信息
s.version = '1.0.2'
s.license = { :type => 'MI... |
# Control the Loop
# Modify the following loop so it iterates 5 times instead of just once.
# iterations = 1
#
# loop do
# puts "Number of iterations = #{iterations}"
# break
# end
# I tried, but wasn't exactly sure how to solve this. Funnily, I found it easy to formulate an answer in a while loop. It just made ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.