text stringlengths 10 2.61M |
|---|
class Student
attr_accessor :first_name
@@all = []
def initialize(first_name)
@first_name = first_name
@@all << self
end
def self.all
@@all
end
def add_boating_test(boating_name, boating_status, instructor)
BoatingTest.new(self,boating_name,boating_statu... |
#--------------------------------------------------------------------------
# Randomized Enemy Self-Targeting
# Author(s):
# Lone Wolf
#--------------------------------------------------------------------------
# By default, enemy actions set to target a member of their own group will
# always, without exception, targ... |
# Interface
class FlyBehavior
# abstract
def fly
raise "# abstract: Should be defined in the Subclass!"
end
end
class FlyWithWings < FlyBehavior
def fly
puts "I'm flying!!"
end
end
class FlyNoWay < FlyBehavior
def fly
puts "<< I can't fly! >>"
end
end
class FlyRocketPowered < FlyBehavior
... |
# -*- coding: utf-8 -*-
=begin
Escreva um programa, para imprimir os 10 primeiros
múltiplos de 3.
=end
puts("=" * 60)
fim = 30
x = 3
while x <= fim
puts(x)
x += 3
end
puts("=" * 60)
|
#!/usr/bin/env ruby
# -------------------------------------------------------------------------- #
# Copyright 2002-2018, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License... |
class Game < ActiveRecord::Base
attr_accessible :player1, :player1Score, :player2, :player2Score, :player3, :player3Score, :player4, :player4Score, :timestamp
validates :player1, :presence => true
validates :player1Score, :presence => true
end
|
class Time
def sleep_in
date = self
if date.saturday?() == true || date.sunday?() == true
return "Go ahead and sleep in!"
else
return "wake up early!"
end
end
end
|
class CreateSuggestions < ActiveRecord::Migration
def change
create_table :suggestions do |t|
t.text :description, :null => false
t.boolean :accepted, :null => false, :default => false
t.references :game, :null => false
t.references :user, :null => false
t.timestamps
end
add... |
RSpec.describe Player do
describe 'creating' do
it 'should create the cells' do
expect(Cell).to receive(:new).exactly(100).times.and_call_original
Player.new('Akhbar')
end
it 'should create the ships' do
expect(Ship).to receive(:new).exactly(5).times.and_call_original
Player.new('... |
module Kaya
module View
class Parser
# Parses cucumber report html doc
# Divides in each parts of document
# @param [String] source = the html code
# @param [Kaya::Result] the result object
def self.adapt_to_kaya(source, result)
source.gsub! 'Collapse All</p></div></div></... |
require 'rails_helper'
RSpec.describe SectorsController, type: :controller do
before(:each) do
@user = FactoryBot.create(:user)
sign_in @user
end
describe "GET #actions" do
%w(audi diren prof serti).each do |view|
it "render template #{view} with success" do
get :actions, params: { sec... |
# [Launch School - an online school for Software Engineers](https://launchschool.com/lessons/85376b6d/assignments/a76c28ac)
#### Practice Problem 6
# Amend this array so that the names are all shortened to just the first three characters:
# `flintstones = %w(Fred Barney Wilma Betty BamBam Pebbles)`
# Iterate: throu... |
# frozen_string_literal: true
require "kafka/version"
module Kafka
class Error < StandardError
end
# There was an error processing a message.
class ProcessingError < Error
attr_reader :topic, :partition, :offset
def initialize(topic, partition, offset)
@topic = topic
@partition = partiti... |
module BetfairApiNgRails
module Api
module Enums
class ExecutionReportErrorCode
extend Api::Enums::Concerns::Enumable
enumify "ERROR_IN_MATCHER",
"PROCESSED_WITH_ERRORS",
"BET_ACTION_ERROR",
"INVALID_ACCOUNT_STATE",
"INVALID_WA... |
File.open(ARGV[0]).each_line do |line|
first = line.split(';')[0]
second = line.split(';')[1]
first.split(',').collect { |i| i.to_i }.each do |item|
print "#{item} " if second.split(',').collect { |i| i.to_i }.include?(item)
end
puts
end |
class AddColumnsTimelineToPosts < ActiveRecord::Migration
def change
add_column :posts, :timeline_id, :integer
add_column :posts, :timeline_type, :string
end
end
|
require 'spec_helper'
describe FeedbackController do
before do
@request.env['HTTP_REFERER'] = 'http://www.qwyzmo.com/qwyzs'
@user = create_test_user("FactGirl Username", "fg@q.com",
"asdfasdf", "asdfasdf")
test_sign_in(@user)
end
it "sends correct email" do
sample_feedback = "sample feedback 24344"
... |
class Post < ApplicationRecord
validates :title, presence: true
validates :title, length: { minimum: 10 }
has_many :comments
end
|
class ChangeFolderIdToTopicId < ActiveRecord::Migration
def change
rename_column :notifications, :folder_id, :topic_id
end
end
|
require 'spec_helper'
describe ConsultManagement::Susanoo::Admin::ConsultsController do
describe "フィルタ" do
describe "set_consult" do
controller do
%w(edit update destroy).each do |act|
define_method(act) do
render text: "ok"
end
end
end
shared_ex... |
require "rails_helper"
RSpec.describe TableGamesController, type: :routing do
describe "routing" do
it "routes to #index" do
expect(:get => "/table_games").to route_to("table_games#index")
end
it "routes to #new" do
expect(:get => "/table_games/new").to route_to("table_games#new")
end
... |
require 'rails_helper'
describe CollegeActivationWorker do
describe "#perform" do
it "delivers the activation email" do
college = create(:college)
mail = double("mail", deliver_now: nil)
allow(CollegeMailer).to(
receive(:activation).with(college).and_return(mail)
)
Coll... |
module ApplicationHelper
def flash_messages(additional_classes = nil)
# error - non-model error - handle model errors within a form
# alert - devise messages
# notice - general message to the user - not an error
# info - ????
# success - the task you asked for worked!
#Specify additional cla... |
class ApplicationMailer < ActionMailer::Base
default from: 'contact@experimentup.com'
layout 'mailer'
end
|
require 'sinatra'
require_relative 'config/application'
set :bind, '0.0.0.0' # bind to all interfaces
enable :sessions
# Any classes you add to the models folder will automatically be made available in this server file
get '/' do
redirect '/starships'
end
get '/starships' do
# Use a custom Starship class that... |
# See more at: http://blog.tobedevoured.com/post/54523066986/rspec-helper-to-add-find-or-create-to-factorygirl#sthash.n79NQWlu.dpuf
module FactoryGirlHelper
class << self
def find_or_create(*args)
name = args.shift
clazz = nil
# convert from underscores String to camelcase Class
if name.i... |
class Mobile < ApplicationRecord
validates :name, presence: true
belongs_to :brand
# belongs_to :seller
has_one :customer_mobile
has_one :seller, through: :customer_mobile
end
|
module Webex
module Meeting
# comment
class Schedule
include Webex
include Webex::Meeting
attr_accessor :meeting_name, :meeting_type, :list_flag, :meeting_password, :password_filter_feature,
:require_attendee_registration, :automatically_accept_registration, :attendee_information,
... |
# -*- coding: no-conversion -*-
require 'spec_helper'
describe 'issue275' do
it '“/299925.jpg/阿” 进行 base64编码后,最后一位是 “/” 这样会造成服务端解析path 时,因为得不到最后的 “/” 而出现错误' do
origin_path = '/299925.jpg/阿'
encode_path = Base64Plus.encode64('/299925.jpg/阿')
encode_path.include?('/').should == false
Base64... |
# encoding: utf-8
require File.join(File.dirname(__FILE__), 'helper')
class TestSnapshotter < TuneMyGcTestCase
def test_init
snapshots = TuneMyGc::Snapshotter.new
assert_equal 0, snapshots.size
end
def test_take
snapshots = TuneMyGc::Snapshotter.new
snapshots.take(:BOOTED)
assert_equal 1, s... |
class FontLxgwBright < Formula
version "4.156"
sha256 "3d28cd3938b9dd4fa20f7cca7fdb50b60d2d07b6b8411319a4f554b2327abeac"
url "https://github.com/lxgw/LxgwBright/releases/download/v#{version}/LXGWBright.7z"
desc "LXGW Bright"
desc "Merged font of Ysabeau Office and LXGW WenKai Lite"
homepage "https://github.... |
require 'rails_helper'
RSpec.describe SupplyTeachers::DownloadsController, type: :controller do
describe 'GET index' do
context 'when not logged in' do
it 'redirects to gateway page' do
expect(get(:index)).to redirect_to(supply_teachers_gateway_url)
end
end
context 'when logged in' d... |
require 'spec_helper'
describe 'Taxman' do
before(:each) do
@tax_man = TaxMan.new()
end
it 'can update' do
employee = double('Employee', :name => 'hiro', :title => 'manager', :salary => 10000)
expected_msg = "#{employee.name}に新しい税金の請求書を送ります"
expect{ @tax_man.update(employee) }.not_to raise_erro... |
class LandmarksController < ApplicationController
def index
landmarks = Landmark.all
if landmarks
render json: LandmarkSerializer.new(landmarks).to_serialized_json
else
render plain: "Currently there are no landmarks"
end
end
def show
landmark... |
class Game
attr_reader :towers
def initialize(towers = [[3,2,1],[],[]])
@towers = towers
end
def move(from, to)
if valid_move?(from, to)
@towers[to] << @towers[from].pop
else
raise 'not a valid move'
end
end
def valid_move?(from, to)
if @towers[from].empty?
return fa... |
require 'rails_helper'
describe "Industries", type: :feature do
it 'show page displays related careers' do
industry = Industry.create(title: "Technology", description: "Nerd stuff")
Career.create!(industry_id: industry.id, title: "Project Manager", description: "Manages teams of software developers.", salary... |
class ItemsController < ApplicationController
def index
@items = Item.includes(:style).where("status = 'sellable'")
@style = Style.new
@item = Item.new
@clearance_batch = ClearanceBatch.new
respond_to do |format|
format.html
format.csv { render text: @items.to_csv }
end
end
d... |
require_relative 'resolve'
module PdfExtract
module ResolvedReferences
def self.include_in pdf
pdf.spatials :resolved_references, :depends_on => [:references] do |parser|
resolved_refs = []
parser.objects :references do |ref|
resolved_refs << ref.merge(Resolve.find(ref)... |
# == Schema Information
#
# Table name: images
#
# id :bigint(8) not null, primary key
# filename :string
# created_at :datetime not null
# updated_at :datetime not null
#
class Image < ApplicationRecord
mount_uploader :filename, ImagesUploader
end
|
require 'rails_helper'
feature 'user edits an existing idea', js: true do
scenario 'with valid input' do
idea_1 = Idea.create(title: "This is idea #1",
body: "The body of idea #1 should be here")
visit root_path
find(".btn-edit").click
expect(page).to have_content("Edit Id... |
class ChangeDefaultStatusOfBook < ActiveRecord::Migration
def self.up
change_column_default(:books, :status, 'Available')
end
def self.down
change_column_default(:books, :status, 'available')
end
end
|
class CreateSolicitations < ActiveRecord::Migration
def change
create_table :solicitations do |t|
t.references :solicitacao_tipos, index: true
t.references :user, index: true
t.string :observacao
t.timestamps
end
end
end
|
class BreweriesController < ApplicationController
before_filter :authenticate_user!, :except => [:index, :show]
# GET /breweries
def index
if request.format.js?
@breweries = Brewery.find(:all,
:conditions => ['name LIKE ?', "%#{params[:search]}%"])
elsif request.forma... |
require './euler_solution.rb'
require 'date'
class Problem019
include EulerSolution
def run
count = 0
(1901..2000).each do |year|
(1..12).each do |month|
day = Date.new(year, month, 1).wday
if day == 0
count += 1
end
end
end
count
end
end
execute(Pr... |
module Activable
extend ActiveSupport::Concern
included do
scope :active, -> { where(active: true) }
after_initialize :set_active
before_save :set_active
end
private
def set_active
self.active ||= true
end
end
|
describe Twit do
let!(:user) do
User.create(email: 'scumlord@potus.com',
password: '1234',
password_confirmation: '1234',
full_name: 'Donald J. Trump',
user_name: 'realDonaldTrump')
end
let!(:twit) do
Twit.create(user: user,
... |
# frozen_string_literal: true
module SimpleResponse
module_function
def call(status, msg)
{
status: status,
msg: msg,
}
end
end
|
class Incident < ActiveRecord::Base
belongs_to :skill_set
belongs_to :character
belongs_to :category
def self.total_injury_attributes
all.map{|incident| incident.skill_set.attributes}
end
def price
-1 * skill_set.money if skill_set
end
end
|
class AddClientMetadataToToken < ActiveRecord::Migration[6.0]
def change
add_column :temporary_tokens, :os, :string, null: true
add_column :temporary_tokens, :browser, :string, null: true
add_column :temporary_tokens, :hardware, :string, null: true
add_column :temporary_tokens, :ip_address, :string, n... |
FactoryGirl.define do
factory :interaction do
employee_id 1
task "Happy Birthday"
complete true
response false
url "http://www.example.com/857284"
comments "Needs to smile more."
end
end |
# frozen_string_literal: true
class AddDefaultValueToFolderTitle < ActiveRecord::Migration[5.2]
def change
change_column :folders, :title, :string, default: '', null: false
end
end
|
require 'minitest/autorun'
require 'minitest/spec'
require_relative 'clock'
describe Clock do
describe "#degree_from_time" do
it "returns 90 degrees for 3pm" do
clock = Clock.new
assert clock.degree_from_time('3:00 PM') == 90
end
it "returns 90 degrees for 9am" do
clock = Clock.new
... |
Fabricator(:item) do
reserve_met false
title { sequence(:item) {|n| "Item #{n}" }}
ends_at 1.day.from_now
published_at 1.day.ago
watched false
end
Fabricator(:watched_item, from: :item) do
watched true
end
|
require 'spec_helper'
# describe "tracks/new.html.haml" do
# before(:each) do
# assign(:track, stub_model(Track,
# :name => "MyString",
# :pack_id => 1,
# :total_lanes => 1,
# :active_lanes => "MyString"
# ).as_new_record)
# end
#
# it "renders new track form" do
# render
#
... |
class HardwaresController < ApplicationController
def index
respond_to do |format|
format.html
format.json { render json: HardwaresDatatable.new(view_context) }
end
end
def show
@hardware = Hardware.find(params[:id])
@make = @hardware.make
@model = @hardware.model
@serial_number = @hardware.seria... |
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
describe Admin::UploadsController do
describe "route generation" do
it "should map { :controller => 'admin/uploads', :action => 'index' } \
to /admin/blogs/1/uploads" do
route_for(:controller => "admin/uploads", :action => "i... |
require('minitest/autorun')
require('minitest/rg')
require_relative('../group_class.rb')
class TestGroupClass < MiniTest::Test
def setup
options = {
'id' => 1,
'class_name' => 'HIIT',
'capacity' => 10,
'start_at' => '13:00',
'end_at' => '15:00',
'class_date' => '26/04/2019'
... |
class DonationsController < ApplicationController
before_action :set_donation, only: [:show, :edit, :update, :destroy]
def confirm
end
def collect
end
def abort
end
# GET /donations
# GET /donations.json
def index
@donations = Donation.all
end
# GET /donations/1
# GET /dona... |
class AddCloseEmailBodyToDialogue < ActiveRecord::Migration
def change
add_column :dialogues, :close_email_body, :text
end
end
|
class HoldersController < ApplicationController
before_action :find_one, except: %i[create index]
def index
@holders = Holder.all
render json: @holders, status: :ok
end
def show
render json: @holder, status: :ok
end
def create
@holder = Holder.new(holder_params)
if @holder.save
... |
require 'spec_helper'
describe AppPolicy do
subject { AppPolicy.new(user, app) }
context "for a visitor" do
let(:user) { nil }
let(:app) { FactoryGirl.create(:app) }
it { should pundit_permit(:show) }
it { should_not pundit_permit(:create) }
it { should_not pundit_permit(:new) ... |
class PostTag
include HyperMapper::Document
attr_accessible :tag_id, :post_id
autogenerate_id
attribute :tag_id
attribute :post_id
end |
require 'rails_helper'
RSpec.describe User, type: :model do
# pending "add some examples to (or delete) #{__FILE__}"
describe 'presence' do
# it "should validate presence of username" do
# user = User.new(password: "123456")
# expect(user.valid?).to be false
# end
it { should validate_pres... |
class PayeesController < ApplicationController
before_filter :authenticate_user!
load_and_authorize_resource :account
load_and_authorize_resource :payee, through: :account
# GET /payees/new
def new
end
# GET /payees/1/edit
def edit
end
# POST /payees
def create
if @payee.save
redire... |
# encoding: utf-8
require File.expand_path("../spec_helper", __FILE__)
describe "Forms" do
before :each do
browser.goto(WatirSpec.files + "/forms_with_input_elements.html")
end
describe "#length" do
it "returns the number of forms in the container" do
browser.forms.length.should == 2
end
en... |
class Note < ApplicationRecord
belongs_to :user
has_many :note_comments
has_many :note_votes
end
|
require 'azon'
require 'redis'
require 'cache'
class AzonTest
def initialize
@redis = Redis.new
@cache = Cache.new
Azon.subscribe('cache_invalid', method(:msg_handler))
end
def find(id)
@cache[id] ||= @redis.get id
@cache[id]
end
def save(id, value)
@redis.set id, value
Azon.pu... |
class Recipes::FrontEnd < Rails::AppBuilder
def ask
frameworks = {
vue: "Vue",
angular: "Angular 2",
none: "None"
}
framework = answer(:front_end) do
frameworks.keys[
Ask.list("Which front-end framework are you going to use?", frameworks.values)
]
end
set :fr... |
class UserInstitutionsController < ApplicationController
before_action :authenticate_user!
def create
@ui = UserInstitution.find_or_create_by(ui_params)
redirect_to :back
end
def update
@ui = UserInstitution.find(params[:id])
@ui.update(ui_params)
redirect_to :back
end
def destroy
... |
Tabulous.setup do
tabs do
client_tab do
text { 'Client' }
link_path { root_path }
visible_when { true }
enabled_when { true }
active_when { a_subtab_is_active }
end
customers_subtab do
text { 'Customer' }
link_path { root_path }
... |
class AttemptsController < ApplicationController
before_action :set_attempt, only: [:show, :update, :destroy]
# GET /attempts
def index
@attempts = Attempt.all
render json: @attempts, include: [:answers]
end
# GET /attempts/1
def show
render json: @attempt, include: [:answers]
end
# POST... |
require_relative '../helpers/rake_helper_template'
require_relative '../helpers/task_helper_template'
class GetComponentSizes < RakeHelperTemplate
def main(csv_file)
template do |logger|
data_format = "%s, %s, %d\n"
errors = []
File.open(csv_file, 'w') do |file|
file.write('Type, Nam... |
module Localized::Helper
extend ActiveSupport::Concern
included do
if self.respond_to? :before_filter
before_filter :set_locale
end
end
def set_locale
key = site_subdomain(request.subdomains).first.to_s.to_sym
unless Localized::Config.site_to_locale_map[key]
key = Localized::Config... |
require 'pry' # Used to require a gem
require_relative "../bank.rb" # Used to require a file you created
# describe - group of tests
# contet - state (e.g logged in)
# it - individual test
describe Bank do
let(:b) do
Bank.new("Rspec Bank")
end
describe ".new" do
# We should be able to create a Bank
... |
require 'rails_helper'
describe Api::V1::FoodEntriesController, :type => :controller do
before(:each) do
user_params = {
:email => "test@goat-app.com",
:name => "Goaty McGoatface",
:password => "iamthegoat",
:token => SecureRandom.base58(24)
}
@user = User.create(user_params)
... |
class ArticleManager
def initialize(articles)
@articles = articles
end
def worst_articles
@articles.sort {|a,b| a.positive_votes <=> b.positive_votes}
end
def best_articles
@articles.sort {|a,b| b.positive_votes <=> a.positive_votes}
end
def worst_article
worst_articles.first
end
d... |
class Announcement < ActiveRecord::Base
belongs_to :user
validates_presence_of :restaurant_name, :user
before_save -> { user.announcements.for_today.destroy_all }
scope :for_today, -> {
where("created_at >= ?", Time.zone.now.beginning_of_day)
}
def to_s
"#{user.email} wants to go to #{restaurant_n... |
def all_squared_pairs(num)
n = Math.sqrt(num).to_i
res = []
(0..n).each do |a|
b = Math.sqrt(num-a*a)
res << [a,b.to_i] if b == b.to_i && b<=a
end
p res
end
We are asking for a function to take a positive integer value, and return a list of all positive integer pairs whose values - ... |
require 'chemistry/dsl'
Chemistry::DSL.element "Lv" do
symbol "Lv"
atomic_number 116
atomic_weight 292
melting_point
end
|
module SessionsHelper
# Logs in the given member.
def log_in(member)
session[:member_id] = member.id
end
# Returns the current logged-in member (if any).
def current_member
current_member ||= Member.find_by(id: session[:member_id])
end
# Returns true if the member is logged in, false otherwise.
def logged... |
# frozen_string_literal: true
# Regular gem source.
source 'https://rubygems.org'
# Define a safe version of Ruby to use.
# Pulled in from .ruby-version which is used by CI/RVM etc.
ruby File.read('.ruby-version').strip.split('-').first
# Testing & Code Analysis
gem 'rspec'
gem 'rspec-collection_matchers'
gem 'ruboc... |
module Mutant
class Mutator
class Node
module NamedValue
# Mutation emitter to handle named value access nodes
class Access < Node
handle(:gvar, :cvar, :ivar, :lvar, :self)
private
# Emit mutations
#
# @return [undefined]
#
... |
# From: https://github.com/CarlosBonetti/jekyll-last-modified-at
# Original in: https://github.com/gjtorikian/jekyll-last-modified-at
module Jekyll
module LastModifiedAt
class Generator < Jekyll::Generator
def generate(site)
site.each_site_file { |item|
item.data['last_modified_at'] = De... |
class Post < ActiveRecord::Base
belongs_to :box
belongs_to :user
belongs_to :post
attr_accessible :align, :link, :signature, :body, :box_id, :user_id, :post_id
validates :align, :signature, :box_id, presence: true
has_many(
:replies,
class_name: "Post",
foreign_key: :post_id,
primary_key: ... |
module Seelpe
class Constraint
VARIABLE_NAME = %r![a-zA-Z_][a-zA-Z_0-9]*!
def initialize *vars, &block # block will be evaulated with substituted variables
raise ArgumentError,"array of variable names is required"unless vars.is_a? Array
raise ArgumentError,"block is expected" unless block_given?
... |
class VtDirectService
def initialize(invoice_id, params)
@invoice = Invoice.find invoice_id
@vt_token = params[:hidden_vt_token]
end
def build_payment
# Generate Body
body = default_values
body.merge!(credit_card_details)
if @invoice._type == "StoreInvoice"
body.merge!(transaction... |
# frozen_string_literal: true
RSpec.describe 'User Flags Request', type: :request do
include_context 'with user token'
include_context 'with json response'
include_context 'with branch location'
let(:user) { user_regular }
let(:params) { { flags: ['mod_manager'] } }
describe '#add_flags' do
let(:add_... |
class Image < ActiveRecord::Base
include Sidekiq::Worker
include Sidetiq::Schedulable
def redis
$redis
end
recurrence { minutely(1) }
REDIS_CACHE_KEY = Rails.application.config.cloudinary_redis_cache_key
REDIS_IS_CACHED_KEY = Rails.application.config.cloudinary_redis_is_cached_key
CACHE_PATH = Ra... |
class AddCatsToAccesses < ActiveRecord::Migration[5.0]
def change
add_column :accesses, :category_id, :integer
add_column :accesses, :has_access, :boolean
end
end
|
require "cgi"
require "rexml/document"
require "rss-testcase"
require "rss/1.0"
require "rss/dublincore"
module RSS
class TestDublinCore < TestCase
def setup
@prefix = "dc"
@uri = "http://purl.org/dc/elements/1.1/"
@parents = %w(channel image item textinput)
t = Time.iso8... |
#!/usr/bin/env ruby
require './error'
class Player
attr_accessor :number, :board, :name
def initialize(number, name=nil)
@number = number
@name = name.nil? ? "Player #{number.to_s}" : name
end
def turn
end
end
class HumanPlayer < Player
def initialize(number)
name = ""
# Ask for name
... |
require 'lol_api/configuration'
require 'lol_api/connection'
require 'lol_api/types/champion'
require 'lol_api/types/item'
require 'lol_api/types/mastery'
require 'lol_api/types/history_match'
require 'lol_api/types/summoner'
require 'lol_api/types/summoner_masteries'
require 'lol_api/types/summoner_runes'
... |
class AddDescriptionToSocialNetworks < ActiveRecord::Migration
def change
add_column :social_networks, :description, :string, default: ""
end
end
|
class AddNewValuesToEmpresa < ActiveRecord::Migration
def change
add_column :empresas, :iva, :float
end
end
|
FactoryGirl.define do
factory :game_word_answer do
association :user, factory: :student_user_without_origin
association :game_wordable, factory: :game_complete_sentence
correct false
words []
end
end
|
require "test_helper"
module Sources
class LofterTest < ActiveSupport::TestCase
context "A lofter post with commentary under <.ct .text>" do
image_urls = %w[
https://imglf3.lf127.net/img/S1d2QlVsWkJhSW1qcnpIS0ZSa3ZJQ1RxY0lYaU1UUE9tQ0NvUE9rVXFpOFFEVzMwbnQ4aEFnPT0.jpg
https://imglf3.lf127.net... |
class SignInView < DefaultView
include TableViewBuilder
include TableViewBuilder::KeyboardScrolling
attr_accessor :tableView
attr_accessor :emailTextField, :passwordTextField
stylesheet :signInView
def render
drawFields
drawHeader
end
def drawHeader
@tableView.tableHeaderView = UIView.a... |
require 'test_helper'
class ZeroFormatterTest < Minitest::Test
def test_that_it_has_a_version_number
refute_nil ::ZeroFormatter::VERSION
end
def test_can_load
value = ZeroFormatter.load(DataClass, fixture("data.pack"))
refute_nil value
assert_equal -16, value.int16, "value.int16"
asser... |
# frozen_string_literal: true
require 'puppet/type'
require_relative '../../../puppet_x/puppetlabs/registry'
# rubocop:disable Metrics/BlockLength
Puppet::Type.type(:registry_value).provide(:registry) do
desc <<-DOC
@summary Registry_value provider
Manages individual Registry values.
DOC
include Puppet:... |
class CreateRatings < ActiveRecord::Migration
def up
execute <<-SQL
create sequence ratings_id_seq;
create table ratings (
id integer not null
default nextval('ratings_id_seq'),
name varchar(16) not null unique
check (length(name) > 0),
description text,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.