text
stringlengths
10
2.61M
require 'spec_helper' describe SplitIoClient::Cache::Stores::SplitStore do let(:metrics_repository) { SplitIoClient::Cache::Repositories::MetricsRepository.new(config.metrics_adapter, config) } let(:metrics) { SplitIoClient::Metrics.new(100, config, metrics_repository) } let(:active_splits_json) { File.read(File...
require 'migration_helpers' class CreateSprints < ActiveRecord::Migration extend MigrationHelpers def self.up create_table :sprints do |t| t.text :comments t.integer :backlog_id t.timestamps end foreign_key :sprints, :backlog_id, :backlogs end def self.down drop_tabl...
class DropColumnsFromAd2s < ActiveRecord::Migration def change remove_column :ad2s, :frequency remove_column :ad2s, :reach remove_column :ad2s, :pull_date end end
require 'spec_helper' describe WordSearch::FieldInfos do it "should let you add a field with a name" do fis = WordSearch::FieldInfos.new fis.add_field(:body) fis[:body].should_not be_nil end it "should have a default analyzer" do fis = WordSearch::FieldInfos.new fis.add_field(:body) fi...
# frozen_string_literal: true # This service object helps us build a Contact object with the appropriate # contact_type, and assign it to the enrollment organisation. module WasteExemptionsShared class BuildOrganisationContact def self.call(enrollment) unless enrollment.organisation.contact contac...
# == Schema Information # # Table name: assets # # id :integer not null, primary key # bar_code :string # asset_type_id :integer # status :string # description :text # user_id :integer # created_at :datetime # updated_at :datetime # serial_number :string # project...
# == Schema Information # # Table name: photos # # id :integer not null, primary key # caption :string # image :string # created_at :datetime not null # updated_at :datetime not null # owner_id :integer # class Photo < ApplicationRecord validates(:image, {:presence =>t...
class Picture < ActiveRecord::Base mount_uploader :picture_path, FileUploader before_save :update_pictures_attributes validates :volunteer_id, presence: true, :on => :create def update_pictures_attributes self.file_size = picture_path.file.size end end
class EmployeeMailer < ApplicationMailer def welcome(employee_id) @employee = Employee.find(employee_id) mail(to: @employee.email, subject: 'Welcome to Fustany') end end
class UserInterface def initialize @artist = nil @fan = nil @gig = nil end def welcome system "clear" str = " .-..-. .--. _ : `' : : .--':_; : .. :.-..-.: : _ .-. .--. .--. : :; :: :; :: :; :: :' .; :`._-.' :_;:_;`._. ...
class AppGroupPolicy < ApplicationPolicy def show? return true if is_barito_superadmin? app_group_ids = AppGroupUser.where(user: user).pluck(:app_group_id) app_group_ids.include?(record.id) end def new? return true if is_barito_superadmin? false end def create? new? end def upda...
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe RebuildController do describe "routing" do it "should route /rebuild to rebuild#index" do { :get => "/rebuild" }.should route_to(:controller => 'rebuild', :action => 'index') end ...
class FakeJob < ApplicationJob queue_as :default def perform(*args) puts 'Starting a fake job' sleep 3 puts 'Job completed.' end end
# Teskal # Copyright (C) 2007 Teskal # # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABI...
class Api::CommentsController < ApplicationController before_action :require_logged_in, only: [:create, :new, :destroy] # POST /comments # if you create a comment, you actually create to source_post def create Comment.transaction do @post = Post.find(comment_params[:post_id]) @author = @post.user ...
class AddNameToVariant < ActiveRecord::Migration def change add_column :variants, :name, :string add_column :variants, :value, :string remove_column :variants, :size remove_column :variants, :color end end
require "erb" require "json" require "mechanize" require "sequel" RESULTS = "https://orangeeco.envisionconnect.com/api/pressAgentClient/searchFacilities?PressAgentOid=a14e5b5a-0788-490e-95b5-a70d0172bb3c" db = Sequel.connect("sqlite://violations.db") db.create_table?(:facilities) do primary_key :id String :facil...
require 'rails_helper' RSpec.describe GetAgentPage do include ModelHelper before do (0...BULK_CREATE_SIZE).each { |i| create(:admin_creates_agent, email: "xxxx#{i}@xxx.xxx") } end it 'Find Agent interactor exists' do expect(class_exists?(GetAgentPage)).to eq(true) end it 'send page' do result...
class FontTiltWarp < Formula head "https://github.com/google/fonts/raw/main/ofl/tiltwarp/TiltWarp%5BXROT%2CYROT%5D.ttf", verified: "github.com/google/fonts/" desc "Tilt Warp" homepage "https://math-practice.github.io/tilt-specimen/" def install (share/"fonts").install "TiltWarp[XROT,YROT].ttf" end test ...
require 'rails_helper' RSpec.describe RegistrationsController, type: :controller do let(:valid_attributes) { { name: "John", email: "john@doe.com", password: "Password", password_confirmation: "Password" } } let(:invalid_attributes) { { name: "John", email: "johndoe", password: "shor...
require 'test_helper' class HomePageTest < ActionDispatch::IntegrationTest def setup @user = users(:tomas) end test "home page - dashboard" do log_in_as @user assert_redirected_to root_path follow_redirect! assert_template 'static_pages/home' assert_select "div[id=?]", "chart_capa...
require 'rails_helper' RSpec.describe ExercisesController, type: :controller do let!(:exercise) { create(:valid_exercise) } describe 'GET #new' do it 'returns a success response' do get :new, params: { session_id: exercise.session_id } expect(response.status).to eq 200 end end describe '...
# Custom fact to test if there is a SMTP daemon listening on port 25 on a non-local port # CIS 2.2.15 Ensure mail transfer agent is configured for local-only mode (Scored) # # This is done by directly probing /proc/net/tcp*, as that is guaranteed to be available on Linux. # Tools such as netstat, ss, lsof or fuser are ...
class ChangeIsActivetoActive < ActiveRecord::Migration def change rename_column :users, :is_active, :active end end
class OwnerConfirmationsController < ApplicationController def show @owner = Owner.confirm!(:confirmation_token => params[:confirmation_token]) if @owner.errors.empty? flash[:success] = 'Account is confirmed.' sign_in_and_redirect :user, @owner else flash[:failure] = 'Invalid confirmati...
class Response < ActiveRecord::Base validates :user_id, presence: true validates :answer_option_id, presence: true validate :respondent_has_not_already_answered_question # validate :author_cannot_answer_own_question # Response#question has_one :question, :through => :answer_option, source: :question bel...
require 'vcr' require 'zlib' require 'stringio' require 'psych' # A custom VCR serializer for prettier YAML output module StyledYAML # Tag strings to be output using literal style def self.literal obj obj.extend LiteralScalar return obj end # http://www.yaml.org/spec/1.2/spec.html#id2795688 module L...
Rails.application.routes.draw do mount ActionCable.server => '/cable' root 'posts#index' resources :chat_rooms, only: [:new, :create, :show, :index] resources :subjects, only: [:index, :show] resources :posts, only: [:index, :show] resources :classes_timetables, only: [:index] do resources :lessons, o...
class WeatherPoint include ActiveModel::Model include ActiveModel::Validations include Redis::Persistence GPS_PRECISION = 100_000 # Attributes property :lat property :lon property :description property :temperature property :wind_speed validates :lat, :lon, presence: true # Qu...
class HighScoresController < ApplicationController def create @pin = Pin.find(params[:pin_id]) @high_score = @pin.high_scores.build(high_score_params) @high_score.user_id = current_user.id if @high_score.save flash[:success] = "High score saved!" redirect_to pin_path(@high_score.pin) ...
require 'rails_helper' describe Event do before(:each) do @team = Team.create(name: "test_team") @user = User.create(name: "test_user", team_id: @team.id) @project = Project.create(name: "test_project", team_id: @team.id) @access = Access.create(user_id: @user.id, project_id: @project.id) @todo =...
class AddDiscountToBillRecords < ActiveRecord::Migration[5.0] def change add_column :medicine_bill_records, :discount, :float end end
#-- # Copyright (c) 2010-2012 Michael Berkovich, tr8nhub.com # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, mod...
#! /usr/bin/ruby # # filtRead.rb # # Copyright (c) 2016 - Ryo Kanno # # This software is released under the MIT License. # http://opensource.org/licenses/mit-license.php # require_relative "SAMReader.rb" require "optparse" def count_cigar(cigar) t=cigar.scan(/(\d+)([MIDNSHP=X])/) cc_hash={"M"=>0, "I"=>0, "D"=>0,...
require "test_helper" describe VehiclesController do let(:fake_time) { Time.parse("2016-04-07T19:51:57.918Z") } let(:person) { FactoryGirl.create :person, id: 1 } before do @request.headers['Content-Type'] = 'application/json' end describe "GET: index" do before do Time.stub :now, fake_time d...
# Class for defining blueprint dependencies. class Blueprints::Dependency instance_methods.each { |m| undef_method m if m =~ /^(to_|id$)/ } # Initializes new Blueprints::Dependency object. # @example Build blueprint 'blueprint' and returns value of @blueprint instance variable. # Blueprints::Dependency.new(:...
require_relative 'day12' describe Assembler do let(:file) { StringIO.new(<<INPUT cpy 41 a inc a inc a dec a jnz a 2 dec a INPUT ) } let(:input) { file.readlines.map { |x| x.strip } } let(:a) { Assembler.new } describe 'parse' do it 'works' do a.parse input p a.regis...
$:.unshift File.join(File.dirname(__FILE__),"..","lib") $:.unshift File.join(File.dirname(__FILE__)) require 'minitest/autorun' require 'rim/git' require 'rim/module_info' require 'rim/status_builder' require 'rim/sync_helper' require 'test_helper' require 'fileutils' class SyncHelperTest < Minitest::Test include F...
class BorisLogger < Logger def initialize(log_device) super(log_device) self.datetime_format = '%m-%d-%Y %H:%M:%S' self.formatter = proc do |severity, time, progname, msg| sprintf("%-5s %-24s %-27s %-s\n", severity, time, progname, msg) end end end module Boris @@logger = BorisLogger.new(...
class Order class Service < ApplicationRecord self.table_name = 'order_services' belongs_to :order, class_name: 'Order' belongs_to :partner_service, class_name: 'Partner::Service' validates :order_id, :partner_service_id, presence: true end end
class User < ActiveRecord::Base has_many :bookmarks has_many :likes, dependent: :destroy has_secure_password validates_uniqueness_of :email def liked(bookmark) likes.where(bookmark_id: bookmark.id).first end end
class Round < ActiveRecord::Base has_many :roulette_prizes COLOURS = ["VERDE","ROJO","NEGRO"] # (0 = verde) ; (1 = rojo) ; (2 = negro) COLOR=["#3bc623","#c62323","#000000"] PLAY = lambda{ colour_index= rand(1..1000) if colour_index >= 491 && colour_index <= 510 puts "VER...
class VisitorsController < ApplicationController def new @owner = Owner.new("Stewart",Date.new(1966,9,10)) render 'visitors/new' end end
# encoding: utf-8 ## see textutils/title.rb ## for existing code ## move over here #### ## fix: turn it into a class w/ methods # #e.g t =TitleMapper.new( records, name ) # e.g. name='team' # t.map!( line ) # t.find_key!( line ) # etc. module TextUtils class TitleMapper ## todo/check: rename to NameM...
require 'rails_helper' RSpec.describe ApplicationHelper do describe "#format_date" do it "should return a formatted date" do expect(helper.format_date(Date.new(2015, 8, 4))).to eq("08/04/2015") end end describe "#format_datetime" do it "should return a formatted datetime" do expect(he...
# frozen_string_literal: true require "test_helper" class ToxiproxyTest < MiniTest::Unit::TestCase def teardown Toxiproxy.grep(/\Atest_/).each(&:destroy) end def test_create_proxy proxy = Toxiproxy.create(upstream: "localhost:3306", name: "test_mysql_master") assert_equal("localhost:3306", proxy.u...
class Book < ApplicationRecord belongs_to :category belongs_to :publisher has_many :loans has_many :users, through: :loans validates_presence_of :title, :author, :description, :ISBN, :image_url validates :slug, uniqueness: true before_validation :generate_slug include PgSearch pg_search_scope :searc...
control "M-1.3" do title "1.3 Ensure Docker is up to date (Not Scored)" desc " There are frequent releases for Docker software that address security vulnerabilities, product bugs and bring in new functionality. Keep a tab on these product updates and upgrade as frequently as when new security vulnerabi...
class Rating include Mongoid::Document field :rating, :type => Integer, :default => 0 referenced_in :ratable, :polymorphic => true referenced_in :person end
json.array!(@correntista) do |correntista| json.extract! correntista, :id, :id, :cpf, :nome, :datanascimento, :endereco, :numero, :bairro, :cidade, :estado json.url correntista_url(correntista, format: :json) end
require 'sinatra' require 'shotgun' require 'pry' require 'csv' def read_beers_from(filename) beers = [] CSV.foreach(filename, headers: true) do |row| beers << { name: row['name'], description: row['description'] } end beers end def save_beer(filename, name, description) CSV.open(filen...
# frozen_string_literal: true require 'rails_helper' RSpec.describe Shortener do let(:original) { 'http://www.original.com' } let(:shortened) { 'https://www.localhost:3000/ijwn6xq' } describe '.call' do subject(:call) { described_class.call(original) } context 'when original URL already exists' do ...
class User < ActiveRecord::Base attr_accessible :address, :age, :birthday, :email, :facebook, :gender, :password, :realname, :tweeter, :username, :password_confirmation has_secure_password validates_uniqueness_of :username validates_uniqueness_of :email validates_presence_of :address validates_presence_of ...
class Cook < RecipeUser has_many :tried_recipes, foreign_key: :recipe_user_id has_many :recipes, through: :tried_recipes end
class RenameShopDescreptionColumnToShops < ActiveRecord::Migration[5.2] def change rename_column :shops, :shop_descreption, :shop_description end end
class Note < Termcap2 self.table_name = "Note" self.primary_key = "Id" belongs_to :Terminal, class_name: :Terminal, foreign_key: :TerminalId end
require 'test_helper' class UserLastCatagoriesControllerTest < ActionDispatch::IntegrationTest setup do @user_last_catagory = user_last_catagories(:one) end test "should get index" do get user_last_catagories_url, as: :json assert_response :success end test "should create user_last_catagory" do...
require 'geocoder' class City < ActiveRecord::Base attr_accessible :name, :country, :longtitude, :latitude validates :name, :presence => true validates :country, :presence => true has_many :tags def get_nearest_cities end before_save :strip_name_country, :geocode_lon_lat, :validate_city_exist...
class ExoplanetSerializer < ActiveModel::Serializer attributes :id, :name, :dist_from_earth, :planet_mass end
set :application, "checkpoint" set :user, 'deploy' set :domain, 'laboratoriomacias.com' role :web, domain # Your HTTP server, Apache/etc role :app, domain # This may be the same as your `Web` server role :db, domain, :primary => true # This is where Rails migrations wil...
#!/bin/env ruby # encoding: utf-8 require_relative 'ledborg' if ARGV[0].nil? puts "\n usage: #{$0} blink | sequence_random_full | sequence_random_list" puts "example: ruby #{$0} blink\n\n" exit 2 end action = ARGV[0] led = LEDBORG.new if action == "blink" led.blink elsif action == "sequence_rand...
class CompileToCHeader attr_accessor :worksheet attr_accessor :gettable attr_accessor :settable def self.rewrite(*args) self.new.rewrite(*args) end def rewrite(input,sheet_names_file,output,defaults = nil) c_name = Hash[sheet_names_file.readlines.map { |line| line.strip.split("\t")}][worksh...
# frozen_string_literal: true module Decidim module Opinions module Admin # A command with all the business logic when an admin batch updates opinions category. class UpdateOpinionCategory < Rectify::Command # Public: Initializes the command. # # category_id - the category id...
require 'spec_helper' describe Author do it 'should have last name' do Author.new(last_name: nil, first_name: 'test', middle_name: 'test').should_not be_valid end it 'should have first name' do Author.new(last_name: 'test', first_name: nil, middle_name: 'test').should_not be_valid end end
class Description::EC2 < Description def initialize(description) description[:service] ||= :ec2 @description = description end def name (tags && tags["Name"]) || aws_instance_id end def aws_id aws_instance_id end def status aws_state end def region_zone aws_availability_zon...
require 'spec_helper' describe UsersController do context "Adding a new user" do it "should get errCode 1 and count 1 with valid credentials" do post :add, { format: 'json', username: "pika", password: "chu" } response.should be_success response_body = JSON.parse response.body response_body.should have...
# encoding: utf-8 require 'spec_helper' describe QoolifeApi do describe "hello world" do it "should answer world when said hello" do expect(QoolifeApi::Hello.say_hello).to eq({ 'hello' => 'world' }) end end describe "journal entries" do it "should return 401 unauthorized for unauthorized user"...
class Patient < ApplicationRecord has_many :appointments has_many :physicians, through: :appointments accepts_nested_attributes_for :appointments, allow_destroy: true accepts_nested_attributes_for :physicians end
# This file is copied to spec/ when you run 'rails generate rspec:install' ENV["RAILS_ENV"] ||= "test" require "spec_helper" require File.expand_path("../../config/environment", __FILE__) require "rspec/rails" require "capybara/poltergeist" Capybara.javascript_driver = :poltergeist # Requires supporting ruby files wi...
RSpec::Matchers.define :be_a_question_representation do |question| match do |json| response_attributes = question.sliced_attributes %w( id created_at updated_at text ) expect(json).to be expect(json).to include_attributes(response_attributes) question.answer_variants.zip(...
class Notifier < ActionMailer::Base def contact_message(contact) recipients 'info@onestoryroad.com' from contact.email bcc "caleb@onestoryroad.com" subject 'Website Contact Inquiry' content_type 'text/html' body :name => contact.name, :email => contact.email, :message => contact.message end def re...
require 'rake' require 'rake/testtask' load "lib/tasks/index.rake" load "lib/tasks/deploy_links.rake" task :default => [:test] desc "Run all tests" task :test => ['test:units', 'test:acceptance'] namespace :test do desc "Run unit tests" Rake::TestTask.new("units") { |t| t.pattern = 'test/unit/*_test.rb' ...
require 'rails_helper' describe "the user sign up path" do it "allows a user to sign up" do visit '/' click_on 'Signup!' fill_in 'Email', with: 'user@gmail.com' fill_in 'Password', with: '123456' fill_in 'Password confirmation', with: '123456' click_on 'Sign Up' expect(page).to have_conte...
require 'rails_helper' RSpec.feature "user searches for an item using search bar on homepage", type: :feature do scenario "user searches for an item using search bar" do item1, item2 = create_list(:item, 3) visit root_path fill_in "Store Quick Search", with: item1.title click_button "Search" ex...
#!/usr/bin/env ruby # Copyright: # (c) 2006 InquiryLabs, Inc. # Visit us at http://inquirylabs.com/ # Author: Duane Johnson (duane.johnson@gmail.com) # Description: # Runs 'rake' and executes a particular task require 'optparse' require 'rails_bundle_tools' require "#{ENV["TM_SUPPORT_PATH"]}/lib/escape" require...
require 'iso/iban' module BicFinder class Bank include ISO attr_reader :bic, :names def self.update_all AustrianBank.update BelgianBank.update GermanBank.update end def self.valid_update? Digest::MD5.file(data_file).hexdigest == self::SOURCE_CHECKSUM end def se...
class CreateDeposits < ActiveRecord::Migration def change create_table :deposits do |t| t.belongs_to :depositor, index: true, foreign_key: true t.belongs_to :collection, index: true, foreign_key: true t.string :title t.text :abstract t.string :item_in_hyacinth t.datetime :embar...
# remove duplicate mp3 files from iTunes require 'find' dir = "/Volumes/music/iTunes" Find.find(dir) do |path| if FileTest.directory?(path) next else if path =~ / \d\.\m4a$/ p "Deleting " + path File.delete path end end end
require 'spec_helper' describe AngellistApi::Request do class DummyRequest; include AngellistApi::Request; end let(:dummy) { DummyRequest.new } let(:sample_path) { "/index" } let(:sample_params) { { :sample => "params" } } let(:sample_options) { { :sample => "options" } } describe "#get" do it "calls...
class CreateTeams < ActiveRecord::Migration[5.2] def change create_table :teams do |t| t.string :name t.text :what_you_do t.text :what_musical_artist t.text :best_concert t.text :coolest_experience t.text :consume_cannabis t.text :which_instrument t.text :beauty_pro...
require 'rails_helper' RSpec.describe Transfer do it { is_expected.to belong_to :seller } it { is_expected.to belong_to :buyer } it { is_expected.to belong_to :animal } end
class ApplicationController < ActionController::Base before_action :set_shopping_cart private def set_shopping_cart unless session[:shopping_cart_id] session[:shopping_cart_id] = ShoppingCart.create.id end @shopping_cart = ShoppingCart.find(session[:shopping_cart_id]) end end
FactoryBot.define do factory :user do nickname {Faker::Name.initials(number: 2)} email {Faker::Internet.free_email} password {'a1'+Faker::Internet.password(min_length: 6)} password_confirmation {password} family_name {'あ一ア'} first_name {'い二イ'} fami...
require 'spec_helper' describe Task do before do @task = FactoryGirl.create(:task) end subject { @task } it { should respond_to(:code) } it { should respond_to(:title) } it { should respond_to(:sequence) } it {should be_valid} end
ActiveAdmin.register Course do permit_params :subject, :number, :title, :time, :days, :room, :instructor, :credit, :description index do selectable_column id_column column :subject column :number column :credit column :title column :time column :days column :room column :in...
class FavouritesController < ApplicationController before_action :authenticate_user! before_action :find_post, except: [:index] def index @favourite_posts = current_user.favourited_posts end def create favourite = Favourite.new(user: current_user, post: @post) respond_to do |format| if f...
pg_ver = input('pg_version') pg_dba = input('pg_dba') pg_dba_password = input('pg_dba_password') pg_db = input('pg_db') pg_host = input('pg_host') control "V-73005" do title "PostgreSQL must produce audit records containing sufficient information to establish the sources (origins) of the events." desc "Info...
def anagrams(word) raise "Input not a string" if word.class != String raise "String must be only one world" if word.include?(" ") output = [] test = word.split("").sort.join("") arr = IO.readlines("./lib/enable.txt") arr.each do |w| if w.strip.split("").sort.join("") == test && w.strip != word ...
#!/usr/bin/env ruby def install_missing(&block) yield rescue LoadError => e gem_name = e.message.split('--').last.strip install_command = 'gem install ' + gem_name # install missing gem puts 'Probably missing gem: ' + gem_name print 'Auto installing' system(install_command) or exit(1) # retry Gem.cl...
require 'spec_helper' describe SitemapsHelper do let(:sitemap_urls) { ['http://hamburg.test.host/events/tesssstooo-999', 'http://hamburg.test.host/locations/blau-mobilfunk-gmbh-999', 'http://hamburg.test.host/'] } it 'returns the right urls' do location = create(:location, id: 999, name: 'blau mobilfunk gmbh'...
# frozen_string_literal: true module Vedeu module Cursors # Each interface has its own Cursor which maintains the position # and visibility of the cursor within that interface. # # @api private # class Cursor include Vedeu::Repositories::Model include Vedeu::Toggleable ex...
require "spec_helper" require "sidekiq/testing" Sidekiq::Testing.fake! describe Sidekiq::Ffmpeg do describe ".get_aspect" do subject { Sidekiq::Ffmpeg.get_aspect("#{sample_dir}/sample_16_9.mp4") } it { should eq "16/9".to_r } end describe "#do_encode" do context "MP4" do subject(:encoder) { ...
class PullRequest attr_accessor :id, :content, :comment, :head_sha, :target_head_sha def initialize(content) @content = content @id = content.number @head_sha = content.head.sha end end
# encoding: UTF-8 require File.expand_path('../lib/ruby-jdict/version', __FILE__) Gem::Specification.new do |s| s.name = 'ruby-jdict' s.summary = "Ruby gem for accessing Jim Breen's Japanese dictionaries" s.homepage = 'https://github.com/Ruin0x11/ruby-jdict' s.require_path = 'lib' s.authors ...
require('test_helper') || require_relative('../test_helper') require 'date' class Vaadin::ExtensionsTest < Minitest::Test def test_with_this result = with_this(Hash.new) { |x| x['hi'] = 'hello hello' } assert_equal(['hi'], result.keys) assert_equal({'hi' => 'hello hello'}, result) end def test_hash...
class Agregar < ActiveRecord::Migration[5.2] def change change_column :reviews, :grade, :intefer, :default => 50 end end
require 'test_helper' module JackCompiler module Transformer class TestVisitorNodeExtractor < Minitest::Test def test_class node = VisitorTestHelper.prepare_tree(<<~SOURCE, root_node: :class) class Foo { field int x, y; field Array map; } SOURCE ...
require 'helper' class LoggingHelpersTest < Vault::TestCase include Vault::Test::LoggingHelpers # The LoggingHelpers mixin attaches a StringIO to Scrolls to capture log # messages. def test_scrolls_logs_to_stream Scrolls.log(key: 'value') assert_equal("app=test_app key=value", Scrolls.stream.string.st...
require 'pry' class School attr_accessor :roster attr_writer :add_student def initialize(school) @school = school @roster = {} end def add_student(student, grade) @roster[grade] ||= [] @roster[grade] << student end def grade(grade) @roster[grade] end def sort sorted_roster...
# frozen_string_literal: false begin require "xml/parser" rescue LoadError require "xmlparser" end begin require "xml/encoding-ja" rescue LoadError require "xmlencoding-ja" if defined?(Kconv) module XMLEncoding_ja class SJISHandler include Kconv end end end end module XML cla...