text stringlengths 10 2.61M |
|---|
class Vote < ActiveRecord::Base
attr_accessible :comment_id, :user_id, :value, :answer_id
belongs_to :comment
belongs_to :user
belongs_to :answer
# validates_uniqueness_of :comment_id, scope: :user_id
validates_inclusion_of :value, in: [1, -1]
validate :ensure_not_author
validate :ensure_no_double_vot... |
##
# This module requires Metasploit: http//metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
class Metasploit4 < Msf::Auxiliary
include Msf::Exploit::Remote::HttpClient
include Msf::Auxiliary::Scanner
include Msf::Auxiliary::Report
... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
#Box Name
config.vm.box = "Rails"
#Box url
config.vm.box_url = "http://static.gender-api.com/debian-8-jessie-rc2-x64-slim.box"
#Forwarded ports, 3000 to rails server
config.vm.network "forwarded_port", guest: 3000, host: 3000
#D... |
class Action < ApplicationRecord
validates_presence_of :name
has_and_belongs_to_many :monsters
end
|
class Api::TodoListsController < ApplicationController
before_action :find_todo_list
def index
@todo_lists = TodoList.all
render json: @todo_lists
end
def show
render json: @todo_list.as_json(include: {todo_list_items: { only: :title}})
end
def create
@todo_list = TodoList.new(list_params... |
# require 'selenium-connect'
desc "Run tests to make sure stuff works great every time!"
task :test => 'setup:ensure_config_exists' do
config = YAML::load_file('config/config.yml')
# Start web server
pid = Process.spawn("php -S #{config['test_url']} -t public/ tests/router.php")
puts "Started a PHP web serv... |
class TodoGadget
def initialize(todos)
@todos = todos
end
def gadget_id
'todo'
end
def title
'Todo'
end
def entries
@todos
end
end |
class SendInvite < ApplicationMailer
default from: "xarronteam@gmail.com"
def send_invite(user)
@user = user
mail(to: @user.email, subject: 'Orangetheory Invitation')
end
def send_pass(user,pass)
@user = user
mail(to: @user.email, subject: 'Password Reset')
end
end
|
class WelcomeController < ApplicationController
def index
redirect_to "http://www.flppdapp.com"
end
def confirm_email
unless params[:code].match(/^[a-zA-Z\d\$\.]{60}$/)
@message = 'Invalid code'
render
end
user = User.find_by(activation_digest: params[:code])
unless user
@m... |
# frozen_string_literal: true
require "spec_helper"
describe GraphQL::Types::Boolean do
describe "coerce_input" do
def coerce_input(input)
GraphQL::Types::Boolean.coerce_isolated_input(input)
end
it "accepts true and false" do
assert_equal true, coerce_input(true)
assert_equal false, c... |
# -*- encoding: utf-8 -*-
# stub: cucumber 4.0.0 ruby lib
Gem::Specification.new do |s|
s.name = "cucumber".freeze
s.version = "4.0.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.metadata = { "bug_tracker_uri" => "https://github.com/cucumber... |
class PlatosController < ApplicationController
before_action :created_and_started_rover,
:created_rover, :only => [:new, :create]
before_action :correct_plato, :only => :destroy
def new
@plato = Plato.new
end
def create
@plato = Plato.create!
@rover = @plato.create_rover
star... |
class Diet < ApplicationRecord
has_many :dish_diets, dependent: :destroy
has_many :dishes, through: :dish_diets
validates :requirement, uniqueness: true, presence: true
end
|
# Calc: A command line calculator program that:
#
# 1. asks for two numbers
# 2. asks for the type of operation:
# add, subtract, multiply, or divide
# 3. displays the result
#
# Using explicit module references and method call perentheses.
def calculator(x, y, op)
y = y.to_f if op == '/'
x.method(op).(y)
end... |
require './csv_import_util'
require './distributor'
require './country'
require 'test/unit'
class TestCsvImportUtil < Test::Unit::TestCase
def test_import
CsvImportUtil.parse_cities_csv('./cities.csv')
CsvImportUtil.parse_distributors_csv('./distributors.csv')
end
end
class TestDistributor < Test::Unit::T... |
#
# Cookbook Name:: etherpad-lite
# Recipe:: default
#
# Copyright 2011, Steffen Gebert / TYPO3 Association
#
# 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/licen... |
require 'rails_helper'
RSpec.describe "pages/show", :type => :view, skip: true do
before(:each) do
@page = assign(:page, create(:page))
@ability = Object.new
@ability.extend(CanCan::Ability)
controller.stub(:current_ability) { @ability }
end
it "renders attributes in <p>" do
render
expec... |
require 'spec_helper'
require 'shanty/graph'
RSpec.describe(Shanty::Graph) do
subject { described_class.new(project_path_trie, projects) }
let(:project_path_trie) { double('project path trie') }
let(:projects) do
[
double('project one'),
double('project two'),
double('project three')
]... |
#!/usr/bin/env ruby
begin
require "ayi"
rescue
require "rubygems"
require "ayi"
end
def clean(*paths)
paths.flatten!
return if paths.empty?
if paths.size > 1
paths.each { |path| clean(path) }
else
path = paths.first
if File.directory?(full_path(path))
confirm "target directory (#{fu... |
require 'spec_helper'
describe Rails::Sh::Command do
context 'when define a command' do
before do
@block = lambda {}
Rails::Sh::Command.define('foo', &@block)
end
it 'We can find it' do
Rails::Sh::Command.find('foo').should eq(@block)
end
it 'We can find nil with wrong name' d... |
class AddNombreToOrdenmesexps < ActiveRecord::Migration[5.1]
def change
add_column :ordenmesexps, :nombre, :string
end
end
|
class MybusinessesController < ApplicationController
before_action :set_mybusiness, only: [:show, :edit, :update, :destroy]
# GET /mybusinesses
# GET /mybusinesses.json
def index
if params[:search]
@mybusinesses = Mybusiness.search(params[:search]).order("created_at DESC")
else
@mybusinesse... |
# encoding: UTF-8
module API
module V1
class EducationalInstitutionsTakePartActions < API::V1::Base
before do
authenticate_user
end
namespace :educational_institutions do
namespace :take_part do
[:all, :accepted, :pending, :rejected].each do |status|
des... |
# Marks TextBlocks which contain parts of the HTML <TITLE> tag, using
# some heuristics which are quite specific to the news domain.
# we create a list of potential titles from the page title
# then we look at every text block and if the text block
# contains a potential title - we set that text block label as :TITLE
... |
# encoding: utf-8
class CatsController < ApplicationController
def index
@cats = Cat.all
@event = Event.find(params[:event_id])
redirect_to event_path(@board)
end
def new
@event = Event.find(params[:event_id])
@cat = @event.cats.build
end
def create
@event = Event.find(pa... |
class Work < ApplicationRecord
validates :title, presence: true
has_many :votes
has_many :users, through: :votes
def self.topten(work)
results = Work.where(category: work)
results = results.sort_by { |result| result.votes.length }.reverse
results = Work.where(category: work) if results.empty?
... |
class RemoveUselessExerciseColumns < ActiveRecord::Migration[5.2]
def change
remove_column :exercises, :name
end
end
|
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
include SessionsHelper
helper_method :current_user
helper_method :logged_in?
before_action :login_required
private
def current_user
@current_user ||= User.find_by(id: session[:user_id])
end
def logged_in?... |
class AddSomecolumnsToBooks < ActiveRecord::Migration[5.2]
def change
add_column :books, :call_number, :string
add_column :books, :publisher, :string
add_column :books, :year_of_publication, :integer
end
end
|
# -*- encoding : utf-8 -*-
class RenameAttachedUserAndAddUserIdInSupportTickets < ActiveRecord::Migration[5.1]
def change
rename_column :support_tickets, :attachedUser, :attachedToTicket
add_column :support_tickets, :attachedUserID, :bigint
end
end
|
class CreateLoaimonans < ActiveRecord::Migration[5.0]
def change
create_table :loaimonans do |t|
t.references :loai, foreign_key:true
t.references :monan, foreign_key:true
t.timestamps
end
end
end
|
class AddSecondServiceToPortfolio < ActiveRecord::Migration[5.2]
def change
add_column :portfolios, :service_id_2, :integer
end
end
|
# == Schema Information
#
# Table name: dams
#
# id :integer not null, primary key
# name :string
# created_at :datetime not null
# updated_at :datetime not null
#
class Dam < ApplicationRecord
has_many :water_releases, dependent: :destroy
has_many :flow_arrival_locations... |
require 'spec_helper'
require 'belafonte/helpers/flags'
module Belafonte
module Helpers
describe Flags do
let(:dummy) {Object.new.extend(described_class)}
describe '#switches' do
it 'is a Hash' do
expect(dummy.switches).to be_a(Hash)
end
end
describe '#switch_a... |
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe DutiesController, type: :routing do
describe 'routing' do
it 'routes to #index' do
expect(get: '/duties').to route_to('duties#index')
end
it 'routes to #generate_duties' do
expect(post: '/duties/generate').to route_to('duti... |
# == Schema Information
#
# Table name: posts
#
# id :bigint(8) not null, primary key
# date :date
# rationale :text
# created_at :datetime not null
# updated_at :datetime not null
# user_id :bigint(8)
# status :integer default("submitted")
#
FactoryBot.defi... |
class Form < ApplicationRecord
belongs_to :company
has_many_attached :files
end
|
class CreateSales < ActiveRecord::Migration
def change
create_table :sales do |t|
t.string :buyer, null: false
t.string :description, null: false
t.decimal :price, precision: 8, scale: 2, null: false
t.integer :quantity, null: false
t.string :address, null: false
t.string ... |
class UploadedFile < ApplicationRecord
audited
acts_as_paranoid
belongs_to :employee
validates :employee, :file_name, :file_type, :s3_identifier, presence: true
end
|
class Vendor < ActiveRecord::Base
has_many :journals, through: :account_line_items, foreign_key: "vendor_id"
default_scope {where(:deleted => nil)}
end
|
# frozen_string_literal: true
RSpec.describe 'Coach Avatar' do
resource 'Coach avatar endpoint' do
route '/api/v1/admin/coaches/:id/avatar', 'Coach avatar' do
let!(:coach) { create(:coach) }
let(:id) { coach.id }
post 'Create Avatar' do
let(:raw_post) { params }
let(:avatar) { ... |
# Given a binary tree, design an algorithm which creates a linked list of all the nodes
# at each depth (e.g., if you have a tree with depth D, you'll have D linked lists)
# will use array's instead of linked lists
def list_depth(head_node)
arrays = []
arrays.push([head_node])
prev_queue = []
prev_queue.concat... |
require "set"
PASS_MATCHER = /^(?<row>[FB]{7})(?<column>[LR]{3})$/
def seat_id(boarding_pass)
row = boarding_pass[:row].tr("FB", "01").to_i(2)
column = boarding_pass[:column].tr("LR", "01").to_i(2)
(row * 8) + column
end
PASSES = INPUT.split("\n").each_with_object(Set.new) do |pass, seat_ids|
seat_ids << se... |
require_relative("../db/sql_runner")
class Film
attr_accessor :title, :price
attr_reader :id
def initialize(options)
@id = options['id'].to_i if options ['id']
@title = options['title']
@price = options['price'].to_i
end
def save()
sql = "INSERT INTO films
(title, price)
VALUES ($1... |
require 'rdomino/database/database_dxl'
require 'rdomino/database/access'
module Rdomino
class Database
autoload 'Option', 'rdomino/database/option'
include DatabaseDxl, DomObject, DxlExportable, WebService::Database
attr_reader :name,:server_path
delegate :title, :title=, :isprivateaddressbook, :i... |
class Project < ApplicationRecord
has_many :pledges
has_many :users, through: :pledges
def total_pledge_amount
total = 0
self.pledges.each do |pledge|
total += pledge.amount.to_i
end
return total
end
def goal_or_goal_met
if self.goal < self.total_pledge_amount
"Original goal ... |
require 'spec_helper'
if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0
describe 'Dehydrated::CRT' do
describe 'accepts x509 cert type' do
[
# rubocop:disable Metrics/LineLength
'-----BEGIN CERTIFICATE-----\nMIIEWjCCAkICAQEwDQYJKoZIhvcNAQELBQAwczELMAkGA1UEBhMCQVQxETAPBgNV\nB... |
require 'virtus'
module GodaddyApi
class Base
include Virtus.model
# Shared by all json responses
attribute :createdAt
attribute :modifiedAt
end
end
|
require 'spec_helper'
module Cb
describe Cb::EducationApi do
context '.get_for <country>'
it 'should get default education code if country is blank ', :vcr => { :cassette_name => 'educationcode/country'} do
ret = Cb.education_code.get_for('not real')
ret.count.should > 1
ret.each do | edu... |
# frozen_string_literal: true
FactoryBot.define do
factory :client do
sequence(:email) { |n| "client#{n}@test.com" }
sequence(:fullname) { |n| "fullname_#{n}" }
sequence(:phone) { |n| "123456#{n}" }
trait :invalid do
email { nil }
end
end
end
|
require 'csvscan'
module EntryImporter
class << self
def import data
count = 0
fields = []
# read uploaded file
file_data = data[:file]
if file_data.respond_to?(:read)
file_contents = file_data.read
elsif file_data.respond_to?(:path)
file_contents = ... |
Types::QueryType = GraphQL::ObjectType.define do
name 'Query'
# Add root-level fields here.
# They will be entry points for queries on your schema.
# field :playbacks do
# type PlaybackType
# argument :id, !types.ID
# resolve -> (obj, args, ctx){
# Playback.find(args[:id])
# }
# end
#... |
# frozen_string_literal: true
require 'rails_helper'
describe Document do
describe 'validations' do
it { is_expected.to validate_length_of(:title).within(2..175) }
it { is_expected.to validate_length_of(:text).with_maximum(3000) }
it { is_expected.to validate_length_of(:tags).within(1..20) }
descri... |
class Vacancy < ActiveRecord::Base
JOB_TYPES = {
part_time: 'part-time',
full_time: 'full-time',
remote: 'удаленно',
office: 'офис',
contract: 'контракт'
}
serialize :job_types, Array
validates :position, :description, :email, :company,
presence: { message: 'Это поле не может б... |
class CreateCrowdblogPortadas < ActiveRecord::Migration
def change
create_table :crowdblog_portadas do |t|
t.integer :breaking_news
t.date :publication
t.timestamps
end
end
end
|
# encoding: utf-8
require 'helper'
class TestAddressHelper < Minitest::Test
def test_normalize_addr
txt_io = [
['Alte Plauener Straße 24 // 95028 Hof', nil, 'Alte Plauener Straße 24 // 95028 Hof'],
['Alte Plauener Straße 24 // 95028 Hof', 'de', '95028 Hof // Alte Plauener Straße 24... |
require_relative '../config/fiat_config.rb'
class ErrorHandler
def self.error_info e
"#{e.inspect}, debug_info: #{e.backtrace[0..2]}"
end
end
class FiatServiceError < StandardError
def code; "ef000"; end
end
class InvalidCommand < FiatServiceError
def code; "ef100"; end
end
class IlleagalRequestError < ... |
class ExpenseCategoriesController < ApplicationController
before_action :set_expense_category, only: [ :edit, :update, :destroy]
# GET /expense_categories
# GET /expense_categories.json
def index
authorize ExpenseCategory
@expense_categories = ExpenseCategory.all
end
# GET /expense_categories/new
... |
require "rails_helper"
RSpec.feature "User can delete a song" do
scenario "User sees the page of all remaining songs for that artist" do
artist = create(:artist)
song = artist.songs.create(title: "Many Loves")
song_two = artist.songs.create(title: "ABCs")
song_three = artist.songs.create(title: "A ... |
class AddImageToPoi < ActiveRecord::Migration
def change
add_column :pois, :marker_image, :binary
end
end
|
require 'spec_helper'
describe Queueable do
it {should belong_to(:video_queue)}
describe "#rating" do
let(:user) { Fabricate(:user) }
it "returns the rating from the review if present" do
populate_queue
expect(Queueable.first.rating).to eq(5)
end
it "returns nil when the rating is not present" do
... |
# code here!
class School
attr_accessor :name
def initialize(name)
@name = name
@roster = {}
end
def roster
@roster
end
def add_student(name, grade)
if @roster[grade]
@roster[grade] << name
else
@roster[grade] = [name]
... |
require 'test/unit'
require 'minitest/reporters'
MiniTest::Reporters.use!
class Proc
def call_handling(an_exception_class,&handler)
call_handling_when lambda { |an_exception | an_exception_class.handles? an_exception },&handler
end
def call_handling_when(a_condition,&handler)
return_continuation = proc ... |
class Reporter
attr_reader :router
def initialize(router)
@router = router
end
def report
puts [@router.x, @router.y, @router.facing.to_s.upcase].join(',')
end
end
|
module RiakRooms
module Client
RIAK_HOST = '10.0.1.201'
def client(host = nil)
@client ||= Riak::Client.new(host: riak_host(host), :protocol=> 'pbc')
end
# Get the number of rows to feed to the progressbar.
def row_count(infile)
`wc -l #{infile}`.chomp.strip.split(' ').first.to_i
... |
# FolderWalker walks folders and calculates
# file and folder size.
#
# Author:: Keith Ballinger (mailto:keith@gmail.com)
# Copyright:: Copyright (c) 2010 Keith Ballinger
# License:: Distributes under the same terms as Ruby
require "./FolderWalker"
require "./Reporter"
if __FILE__ == $0
f = FolderWalker.new("C... |
require "spec_helper"
describe EarthquakesController do
describe "routing" do
it "routes to #index" do
get("/earthquakes").should route_to("earthquakes#index")
end
end
end
describe 'application' do
describe "routing" do
it "does NOT define a root route" do
get("/").should_not be_rout... |
# -*- coding: utf-8 -*-
class ContentsController < ApplicationController
def show
if params[:id] && File.exist?(path = "#{Rails.root.to_s}/app/views/contents/#{params[:id]}.html.erb")
case params[:id]
when "index"
@description = "" + @@description
@keywords = @@keywords
@title ... |
# frozen_string_literal: true
class Document
class Share
include Mongoid::Document
belongs_to :guest, class_name: 'User'
belongs_to :document
field :guest_id, type: User
field :document_id, type: Document
# mock method for test purposes
def inject(_none)
{ none: 0 }
end
end
... |
class User < ApplicationRecord
has_many :investments, dependent: :destroy
VALID_PAN_REGEX = /[A-Z]{5}[0-9]{4}[A-Z]/.freeze
validates :email, :password, :role, presence: true
validates :email, format: { with: URI::MailTo::EMAIL_REGEXP }, uniqueness: true
with_options if: :user_is_paid? do |user|
user.val... |
module Kata
module Algorithms
class ArrayIntersection < Struct.new(:a, :b)
def intersect
# if N = 5 and both have same size
# i = 0, then N comparisons of the N elements of longer to i
# i = 1, then N comparisons of the N elements of longer to I
# ...
# i ... |
class AddImageToDrinks < ActiveRecord::Migration[5.0]
def change
add_column :drinks, :img_src, :string
end
end
|
FactoryGirl.define do
factory :submission do
submitter_email Faker::Internet.email
name Faker::Commerce.product_name
url Faker::Internet.url
end
end
|
# Q:
# 入力として、歩いた距離(km)と歩幅(cm)が与えられるので、
# 1万歩を歩いているかどうかを判定して結果を出力してください。
def km_to_cm(km)
km * 1000 * 100
end
km, cm = gets.split(' ').map(&:to_i)
answer = km_to_cm(km) / cm
if answer >= 10000
puts "yes"
else
puts "no"
end
|
require 'spec_helper'
describe PagesController do
render_views
describe "GET 'home'" do
it "should be successful" do
get 'home'
response.should be_success
end
it "should have the right title" do
get 'home'
response.should have_selector("title",:content => "HCS | Home")
end... |
Rails.application.routes.draw do
root to: 'pages#home'
resources :cocktails do
resources :doses, only: [:new, :create, :destroy]
end
end
|
RSpec.shared_examples "a new_author_form" do
let (:author){mock_model("Author").as_new_record}
before do
allow(author).to receive_messages( first_name: nil,
last_name: nil,
biography: nil)
assign(:author, author)
render
e... |
1. A home page or root route.
* If the user is not logged in, the page should show them a login link.
* If the user is logged in, the page should say, "hi, #{name}", and provide a
logout link.
2. A login page
* Users can enter their name in a form and click 'login'. Thereafter, the app will
refer to them... |
require 'spec_helper'
describe NotSoBignum::Bn do
Bn = NotSoBignum::Bn
TEST_ITERATIONS = 100_000
it 'should support numeric conversion' do
TEST_ITERATIONS.times do
i = Random.rand(1_000_000_000_000)
expect(Bn.from_i(i).to_i).to eq i
end
end
describe 'operations' do
class TestBn
... |
class AddShapeToRegion < ActiveRecord::Migration
def self.up
add_column :regions, :shape, :string, :length => 30
end
def self.down
add_column :regions, :shape
end
end
|
module MapHelper
def get_weather_icon(temp)
case temp
when -500..0
image_tag "verycold.png", class: 'weather-icon'
when 1..31
image_tag "cold.png", class: 'weather-icon'
when 32..50
image_tag "cool.png", class: 'weather-icon'
when 51..86
image_tag "warm.png", class: 'wea... |
class RedoPlacelistIndexonPlaces < ActiveRecord::Migration[5.0]
def change
remove_index :places, column: :placelist_id
add_reference :places, :travelist, foreign_key: true
end
end
|
require 'test_helper'
class CommandsManagerTest < Test::Unit::TestCase
include TChat
def setup
@type = :handshake
@commands_manager = Command::CommandsManager.new
assert_nothing_raised do
@commands_manager.load_commands
end
end
def test_types
types = @commands_manager.types
asse... |
class RemoveMeterFromReports < ActiveRecord::Migration
def up
remove_column :reports, :meter
end
def down
add_column :reports, :meter, :integer, :after => :date
end
end
|
require 'spec_helper'
describe 'fmw_jdk::internal::rng_service_debian', :type => :class do
describe 'on Debian platform' do
let(:facts) {{ osfamily: 'Debian' }}
it {
should contain_exec('sed rng-tools').with(
command: "sed -i -e's/#HRNGDEVICE=\\/dev\\/null/HRNGDEVICE... |
# Model
model:
rest_name: activity
resource_name: activities
entity_name: Activity
package: hojo
group: core/monitoring
description: |-
Contains logs of all the activity that happened in a namespace. All successful
or
failed actions will be available, errors, as well as the claims of
the use... |
module Coul
module Factory
def self.build_pong
header + "PONG\n\n"
end
def self.build_ping
header + "PING\n\n"
end
def self.build_smsg(nick, server, channel, timestamp, message)
"#{header}SMSG #{nick}@#{server} #{channel} #{timestamp}\n#{message}\n"
end
def self.buil... |
class ProgressBar
module Formatter
DEFAULT_FORMAT_STRING = '%t: |%B|'
DEFAULT_NON_TTY_FORMAT_STRING = '%t: |%b|'
DEFAULT_TITLE = 'Progress'
def initialize(options)
self.format_string = options[:format] || DEFAULT_FORMAT_STRING
@title = options[:title] ... |
RSpec.shared_context "test stack" do
let(:inner_app) do
double.tap do |dbl|
ok = [200, {}, ["Hello World"]]
allow(dbl).to receive(:call).with(kind_of(Hash)).and_return(ok)
end
end
let(:app) do
builder = Rack::Builder.new
builder.use Rack::Cleanser
builder.run inner_app
builder... |
# frozen_string_literal: true
module GraphQL
module Execution
class Interpreter
# A container for metadata regarding arguments present in a GraphQL query.
# @see Interpreter::Arguments#argument_values for a hash of these objects.
class ArgumentValue
def initialize(definition:, value:, d... |
class CreateDeliveryInfos < ActiveRecord::Migration[5.1]
def change
create_table :delivery_infos do |t|
t.string :address_line_1
t.string :addresss_line_2
t.integer :phone_number
t.timestamps
end
end
end
|
require_relative '../clients/guest'
module Examples
def self.run(example)
clients = []
clients << Clients::Guest.new
clients.each do |client|
message = "Running #{example.name} with #{client.class.name}"
puts message
puts "-" * message.length
example.run(client)
end
end
en... |
# frozen_string_literal: true
require "rails_helper"
describe EtsPdf::Etl::GroupBuilder do
describe ".call" do
let(:academic_degree_term_course) { build(:academic_degree_term_course) }
let(:group_1) { academic_degree_term_course.groups.find { |group| group.number == 1 } }
let(:group_2) { academic_degree... |
Rails.application.routes.draw do
get '/sign_up', to: 'welcome#new', as: 'sign_up'
devise_for :applicant
devise_for :business
authenticated :applicant do
root to: 'jobs#index'
end
authenticated :business do
root to: 'jobs#index'
end
root 'welcome#index'
resources :jobs do
post 'apply', o... |
module Kata
module Algorithms
# expected worst-case time complexity is O(N);
# expected worst-case space complexity is O(N), beyond input storage (not counting the storage required for input arguments).
#
# N is an integer within the range [1..100,000];
# each element of array A is an integer with... |
require 'fog/core/collection'
require 'fog/sakuracloud/models/compute/server'
module Fog
module Compute
class SakuraCloud
class Servers < Fog::Collection
model Fog::Compute::SakuraCloud::Server
def all
load service.list_servers.body['Servers']
end
def get(id)
... |
require 'rails_helper'
describe GalleryMembership do
describe 'relations' do
it { is_expected.to belong_to :gallery }
it { is_expected.to belong_to :image }
end
end
|
class TuitorTimesController < ApplicationController
def new
@tuitor_time = TuitorTime.new
end
def create
#@admin_idはフォームからではなくキャッシュから取るのでこうした
@tuitor_time = TuitorTime.new(tuitor_time_params.merge(admin_id: current_admin.id))
if @tuitor_time.save
flash[:success] = "Registering available time i... |
FactoryGirl.define do
factory :task do
name "MyString"
description "MyString"
executor nil
author nil
end
end
|
# frozen_string_literal: true
RSpec.describe Dry::Logic::Rule::Predicate do
subject(:rule) { described_class.build(predicate) }
let(:predicate) { str? }
include_context "predicates"
it_behaves_like Dry::Logic::Rule
describe "#name" do
it "returns predicate identifier" do
expect(rule.name).to be... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.