text stringlengths 10 2.61M |
|---|
require "spec_helper"
describe "Edit schedule", :type => :request, :js => true do
let!(:user) { create(:user, :paul) }
let!(:event) { create(:event, :tasafoconf, :users => [ user ], :owner => user.id) }
let!(:talk) { create(:talk, :users => [ user ], :owner => user.id) }
let!(:another_talk) { create(:another_... |
# iterate through every number from 0 to n/2
# if n == x, then true
# if it ends the iteration, then it would be false
# 144 / 2 = 72
# (0..72).each do |x|
# if x * x == n
# true
# else
# next
# false
# end
require 'pry'
def power_of_two?(num)
(1..num/2).each do |x|
return if 2*x == num
end
end
pu... |
module NokogiriMiscellaneousMixins
def sentences
self.xpath("//sentences//sentence")
end
def tokens
self.xpath(".//tokens//token")
end
def _words
self.xpath(".//word")
end
def _word
self.at_xpath(".//word")
end
def pos
self.at_xpath(".//POS")
end
def ner
self.at_xpath(... |
module Yito
module Model
module Booking
class ActivityClassifierTerm
include DataMapper::Resource
storage_names[:default] = 'bookds_activity_classifier_terms'
belongs_to :activity, '::Yito::Model::Booking::Activity', :child_key => [:activity_id], :parent_key => [:id], :key => true... |
class AddFaxColumnsToOffices < ActiveRecord::Migration[6.0]
def change
add_column :offices, :fax, :string
add_column :offices, :fax_2, :string
end
end
|
class GifSerializer < ActiveModel::Serializer
# has_many :favorites
# has_many :users, through: :favorites
attributes :title, :img_url
end
# class PizzaSerializer < ActiveModel::Serializer
# # has_many :favorites
# # has_many :users, through: :favorites
# has_many :ingredients
# attributes :name
# end... |
class Api::MessagesController < ApplicationController
before_action :set_group, only:[:index]
def index
respond_to do |format|
format.html
format.json do
@messages=@group.messages.where('id>?',params[:lastMessageId])
end
end
end
def set_group
@group=Group.find(params[:gro... |
ENV["RACK_ENV"] = "test"
require "minitest/autorun"
require "rack/test"
require "erb"
require "fileutils"
require_relative "../app"
class AppTest < Minitest::Test
include Rack::Test::Methods
def app
Sinatra::Application
end
def setup
FileUtils.mkdir_p(data_path)
create_document('about.txt', 's... |
Pod::Spec.new do |s|
s.name = "AASSVC"
s.version = "0.0.1"
s.summary = "Base on LTScrollview create AASScrollView."
s.description = <<-DESC
base on LTScrollView, develop language swift 4.1
DESC
s.homepage = "https://github.com/Nick-chen/AASScrollView"
s.license = { :type => "MIT", :file =>... |
class Recipe < ActiveRecord::Base
has_many :reviews
belongs_to :user
validates :name, :category, :prep_time, :cook_time, :ingredients, :instructions, presence: true
validates :name, :category, :prep_time, :cook_time, format: { with: /\A[a-zA-Z\d\s]+\z/,
message: "only allows letters and numbers" }
def ra... |
# frozen_string_literal: true
module Mutations
# Offers a non-localized, english only, non configurable way to get error messages. This probably isnt good enough for users as-is.
class CustomErrorMessageCreator < DefaultErrorMessageCreator
MESSAGES = Hash.new("is invalid").tap do |h|
h.merge!(
... |
require 'test_helper'
class MollieTest < Test::Unit::TestCase
include OffsitePayments::Integrations
def setup
@token = 'test_8isBjQoJXJoiXRSzjhwKPO1Bo9AkVA'
JSON.stubs(:parse).returns(CREATE_PAYMENT_RESPONSE_JSON)
end
def test_get_request
@request = Mollie::API.new(@token).get_request("payments/#... |
feature "display sandbox warning" do
include EnvVarSpecHelper
context "showing sandbox warning" do
scenario "on homepage" do
with_env_var('DISABLE_SANDBOX_WARNING', 'false') do
visit root_path
expect(page).to have_content("This sandbox site is for testing and training purposes only")
... |
module CartRepresenter
include Roar::JSON
property :id
property :customer_id
property :order_id
property :line_items, getter: ->(*) { self.line_items }, extend: LineItemsRepresenter
property :address, getter: ->(*) { self.address }, extend: AddressRepresenter
end
|
def migrate_up
migrate :bit_many
end
require 'active_record_helper'
require 'troles_spec'
User.troles_strategy :bit_many do |c|
c.valid_roles = [:user, :admin, :blogger]
end.configure!
describe Troles::Storage::BitMany do
let(:kris) { Factory.create :user, :troles => 2}
subject { Troles::Storage::Bi... |
class CreatePickupLocations < ActiveRecord::Migration
def change
create_table :pickup_locations do |t|
t.references :user
t.string :name
t.string :address
t.float :latitude
t.float :longitude
t.boolean :gmaps
t.datetime :deleted_at
t.timestamps
end
add_inde... |
require 'test_helper'
class ArtistTest < ActiveSupport::TestCase
def setup
@artist = artists(:one)
@song = Song.create(:artist_id => @artist.id, :title => "Some song")
end
test "could have many songs" do
assert @artist.save
assert_equal [@song], @artist.songs
end
end
|
class SensorsGroup < ApplicationRecord
has_many :sensors
validates :nome,presence: true,length: {minimum: 3,maximum: 25}
validates_uniqueness_of :nome
end
|
# frozen_string_literal: true
resource_name :elasticsearch_bulk_directory
self.class.include ::Ayte::Chef::Cookbook::ElasticSearch::ResourceDefinitionMethods
define_common_attributes(timeout: 32)
attribute :path, name_attribute: true
attribute :pattern, [String, Symbol], default: '**/*.{json,jsons}'
attribute :inde... |
# Calculate the mode Pairing Challenge
# I worked on this challenge [with: Kevin Huang ]
# I spent [1.5] hours on this challenge.
# Complete each step below according to the challenge directions and
# include it in this file. Also make sure everything that isn't code
# is commented.
# 0. Pseudocode
# input: Array... |
require "minitest/autorun"
require_relative "../NeuralNet"
class TestNeuralNet < Minitest::Test
def test_constructor
assert(NeuralNet.new([1], [1]).is_a?(NeuralNet))
end
def test_no_hidden_nodes
net = NeuralNet.new([1], [[[1,1]]])
assert_equal([0.8807970779778823], net.calculate([1, 1]))
end
... |
class Bs::Elawa::SegmentSerializer < ActiveModel::Serializer
attributes :id, :name, :event_id, :start_date, :end_date
has_many :performances
belongs_to :event
end
|
require "spec_helper"
describe Notifications do
it "invitation should send to current player of game" do
game = Factory(:game)
game.current_player = game.black_player
mail = Notifications.invitation(game)
mail.subject.should == "[Go vs Go] Invitation from #{game.white_player.username}"
mail.to.sh... |
$: << File.dirname(__FILE__)
require 'spec_helper'
module SqlPostgres
describe Translate do
describe '::escape_sql' do
def self.pi
3.1415926535897932384626433832795028841971693993751058209749445923
end
def self.testCases
[
[nil, 'null'],
["", "E''"],
... |
class RoomsController < ApplicationController
soap_service namespace: 'urn:WashOut'
soap_action "AddCircle",
:args => { :circle => { :center => { :@x => :integer,
:@y => :integer },
:@radius => :double } ... |
# frozen_string_literal: true
# Handles player input for moves and pawn promotion
class Player
attr_reader :name, :color, :icon
def initialize(name)
@name = name
@color = nil
@icon = nil
end
def color=(color)
@color = color
@icon = color == :w ? "\u2654" : "\u265A"
end
def make_move
... |
require 'highline/import'
namespace :fedbus do
desc "Add an administrative user"
task :admin, :userid, :needs => :environment do |t, args|
userid = args[:userid] || ask("User ID: ") { |uid| uid.validate = /^[a-z\d]+$/ }
admin_role = Role.find_by_name("Administrator")
if admin_role.nil?
say "Adm... |
Rails.application.routes.draw do
resources :secrets
get 'main/page'
get 'main/new'
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
root to: "main#page"
end
|
class FamilyInvitation < ApplicationRecord
enum status: {
pending: 0,
accepted: 1,
declined: 2
}, _prefix: true
belongs_to :inviter_profile, class_name: 'UserProfile'
belongs_to :user_profile, autosave: true
validates :user_profile_id, :inviter_profile_id, :email, presence: true
validates :em... |
class AssocsController < ApplicationController
swagger_controller :assocs, "Associations management"
before_action :authenticate_volunteer!, except: [:index, :show, :pictures, :main_picture],
unless: :is_swagger_request?
before_action :authenticate_volunteer_if_needed,
only: [:i... |
class AddAttachmentToMenus < ActiveRecord::Migration
def change
add_attachment :menus, :game_pic
add_attachment :menus, :game_icon
end
end
|
class AddNameToSchedulators < ActiveRecord::Migration
def change
add_column :schedulators, :name, :string
end
end
|
FactoryBot.define do
factory :school_device_allocation do
std
association :school
association :created_by_user, factory: :dfe_user
association :last_updated_by_user, factory: :dfe_user
trait :std do
device_type { 'std_device' }
end
trait :coms do
device_type { 'coms_device' }... |
rule ".rb" => ".treetop" do |task, args|
# TODO(sissel): Treetop 1.5.x doesn't seem to work well, but I haven't
# investigated what the cause might be. -Jordan
Rake::Task["gem:require"].invoke("treetop", "~> 1.4.0", ENV["GEM_HOME"])
require "treetop"
compiler = Treetop::Compiler::GrammarCompiler.new
compil... |
require 'test_helper'
class SiteLayoutTest < ActionDispatch::IntegrationTest
# test "the truth" do
# assert true
# end
test 'layout links' do
get root_path
assert_template 'static_pages/home'
assert_select 'a[href=?]', root_path, count: 2
assert_select 'a[href=?]', help_path
assert_... |
require 'spec_helper'
describe Link do
it { should validate_presence_of(:title) }
it { should validate_presence_of(:url) }
it { should validate_presence_of(:user_id) }
it { should have_many(:comments) }
it { should belong_to(:user) }
it { should have_many(:subs) }
it { should allow_mass_assignment_of(... |
class AddSeasonColumnToSeedBags < ActiveRecord::Migration[5.0]
def change
add_column :seed_bags, :season, :string
end
end
|
class Vote < ActiveRecord::Base
belongs_to :submission
belongs_to :faculty
end
|
class User < ApplicationRecord
validates(:username, presence: true,
uniqueness: true)
validates(:email, presence: true,
uniqueness: true)
validates(:password, presence: true,
length: { minimum: 6 })
has_m... |
require 'debugger'
require 'digest/sha1'
enable :sessions
get '/' do
erb :index
end
get '/logout' do
logout!
redirect '/'
end
post '/sign_up' do
@encrypted = Digest::SHA1.hexdigest(params[:password])
@user = User.create(email: params[:email], password: @encrypted)
@user.valid? ? @message = "New user... |
# Computes factorial of the input number and returns it
def factorial(number)
raise ArgumentError.new if number.class != Integer
return 1 if number <= 1
f = 1
i = 0
while (number-i) > 0 do
f *= (number-i)
i += 1
end
return f
end
|
# ================================================================
# Created: 2015/04/29
# Author: Thomas Nguyen - thomas_ejob@hotmail.com
# Purpose: Keep all filename locations
# ================================================================
module FileNames
CONST_DEFAULT = "../config/constants.rb"
CONST_FILENAME... |
class Shopper < ActiveRecord::Base
has_many :shopper_assignments
validates :username, presence: true, uniqueness: {case_sensitive: false}, length: {minimum:3, maximum:25}
validates :password, presence: true, length: {minimum: 3, maximum: 25}
before_save {self.username = username.downcase}
has_secure_password... |
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
# rubocop:disable Layout/LineLength
require_relative('pod_helpers')
def add_flipper_pods!(versions = {})
versions['Flipper'] |... |
class GlobalContext
# In case methods are called on GlobalContext when it has not been set up (such as
# from shell scripts or tests), an instance of this class provides the default
# request data.
attr_accessor :password_reset
class NullRequest
attr_accessor :host
attr_accessor :url
attr_accesso... |
# frozen_string_literal: true
module Api::V1
class ResetPasswordController < ::Api::V1::ApplicationController
skip_before_action :authenticate_user, only: %i[create]
def create
api_action do |m|
m.success do
head 202
end
end
end
end
end
|
# frozen_string_literal: true
require "graphql/query/null_context"
module GraphQL
class Schema
class Object < GraphQL::Schema::Member
extend GraphQL::Schema::Member::HasFields
extend GraphQL::Schema::Member::HasInterfaces
# @return [Object] the application object this type is wrapping
a... |
class CreateStudentAttachmentCategories < ActiveRecord::Migration
def self.up
create_table :student_attachment_categories do |t|
t.string :attachment_category_name
t.boolean :is_deletable, :default => 0
t.integer :creator_id
t.timestamps
end
end
def self.down
drop_table :stud... |
class StationsController < ApplicationController
def index
@stations = Station.all
respond_to do |format|
format.html
format.json { render json:@stations}
end
end
end
|
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.provider "virtualbox" do |v|
v.name = "swagger-codegen"
... |
class Api::ArticlesController < ApplicationController
before_action :authenticate_user!, only: [:create, :update]
def index
articles = Article.all
render json: { articles: articles }
end
def show
article = Article.find(params['id'])
render json: { article: article }, status: 200
end
# Rec... |
class AddUuidToUser < ActiveRecord::Migration
def self.up
add_column :users, :uuid, :string, limit: 36, unique: true
add_index :users, :uuid, unique: true
end
def self.down
remove_index :users, :uuid
remove_column :users, :uuid
end
end
|
class Investment < ApplicationRecord
belongs_to :user
validates :returnRate, :totalExpectedReturn, :totalInvestedAmount, presence: true
validates :timePeriod, presence: true, numericality: {only_integer: true}
with_options if: :mode_is_sip? do |investment|
investment.validates :monthlyInvestment, presence:... |
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
has_many :lists... |
class Todo < ActiveRecord::Base
validates :description, :priority, presence: true
validates :priority, numericality: { only_integer: true, greater_than: 0, less_than: 10 }
belongs_to :user
end
|
module Topographer::Generators
module Helpers
def underscore_name(name)
name.gsub(/::/, '/').
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
gsub(/([a-z\d])([A-Z])/,'\1_\2').
tr("-", "_").
downcase
end
end
end
|
require File.dirname(__FILE__) + '/../test_helper'
require 'login_controller'
# Re-raise errors caught by the controller.
class LoginController; def rescue_action(e) raise e end; end
class LoginControllerTest < Test::Unit::TestCase
fixtures :users
def setup
@controller = LoginController.new
@request ... |
class AddOtherCnNameToWines < ActiveRecord::Migration
def change
add_column :wines, :other_cn_name, :string
end
end
|
class CommentsController < ApplicationController
before_action :comment_owner, only: [:destroy]
def comment_owner
@post = Post.find(params[:post_id])
@comment = @post.comments.find(params[:id])
unless @comment.user_id == current_user.id||@post.user_id == current_user.id
flash[:notice] = ... |
class Emailer
def initialize
@mandrill = Mandrill::API.new(ENV["MANDRILL_API_KEY"])
end
def voicemail_notification(url, duration)
message = {
"text" => "A new voicemail has arrived!\n\nListen to it here: #{url}\n#{duration} seconds long.",
"subject" => "New Voicemail",
"from_email" => E... |
require 'test_helper'
class NonCampusStateTotalsControllerTest < ActionDispatch::IntegrationTest
setup do
@non_campus_state_total = non_campus_state_totals(:one)
end
test "should get index" do
get non_campus_state_totals_url
assert_response :success
end
test "should get new" do
get new_non_... |
# In this project, you'll visualize the swapping strategy of selection sort, similar to the screenshot on the right.
# To start off with, you'll need to bring in the selection sort algorithm code from the last challenge. Then, come up with an array of data and send that through the algorithm. For each iteration of th... |
class Piece
attr_accessor :color, :board, :position, :piece_type, :value
def initialize(board, color, position, piece_type)
@color = color
@board = board
@position = position
@piece_type = piece_type
end
def move!(to_position)
if board[to_position].nil?
@position = to_position
els... |
class Order < ApplicationRecord
belongs_to :batch, optional: true
enum status: %i[ready production closing sent]
validates :reference, :purchase_channel, :client_name, :address,
:delivery_service, :total_value, :line_items, presence: true
def self.last_by_client(client_name)
where(client_name:... |
class User < ActiveRecord::Base
has_many :questions, dependent: :nullify
has_many :answers, dependent: :nullify
has_many :likes, dependent: :destroy
has_many :liked_questions, through: :likes, source: :question
has_many :favourites, dependent: :destroy
has_many :favourite_questions, through: :favourites,... |
class Contest < ActiveRecord::Base
validates :title, :start, :end, :visibility, :participation, :presence => true
validates :visibility, :inclusion => { :in => ["public", "unlisted", "invite_only"] }
validates :participation, :inclusion => { :in => ["public", "invite_only"] }
validate :starting_and_ending_time_... |
module Concerns::EmergencyInfo::Method
extend ActiveSupport::Concern
included do
scope :publishes, -> {where("display_start_datetime <= ? AND display_end_datetime >= ?", Time.now, Time.now)}
end
module ClassMethods
def stop_public
now_time = DateTime.now
emergency_info = self.first
i... |
# frozen_string_literal: true
module Api::V1::Admin::Users::ResetPassword
CreateSchema = Dry::Validation.Params(BaseSchema) do
required(:user_id).filled(:int?)
end
end
|
class TweetsController < ApplicationController
before_action :set_tweet, only: [:show, :edit, :update, :destroy]
# GET /tweets
# GET /tweets.json
def index
@tweets = Tweet.all
end
# GET /tweet/1
# GET /tweet/1.json
def show
end
# GET /tweet/new
def new
@tweet = Tweet.new
end
# GET ... |
class Addcomment < ActiveRecord::Migration
def up
add_column :staff_admins,:comment,:string
end
def down
end
end
|
# frozen_string_literal: true
class TestPassagesController < ApplicationController
before_action :set_test_passage, only: %i[show update result gist]
def show; end
def result; end
def update
@test_passage.accept!(params[:answer_ids])
@test_passage.abort_test if @test_passage.time_is_up?
if @test... |
require "student_params"
class StudentsController < ApplicationController
skip_before_action :authenticate_account!, only: [:index, :show]
before_action :profile_completedness!, only: [:new, :create]
before_action :set_student, only: [:show, :edit, :update]
def index
@students = Student.all.includes(:acc... |
class PartySerializer < ActiveModel::Serializer
attributes :id, :name, :rsvp
has_many :guests
end
|
class String
def black; "\033[30m#{self}\033[0m" end
def red; "\033[31m#{self}\033[0m" end
def green; "\033[32m#{self}\033[0m" end
def brown; "\033[33m#{self}\033[0m" end
def blue; "\033[34m#{self}\033[0m" end
def magenta; "\033[35m#{self}\033[0m" end
... |
class RemoveJobRequestIdFromQuotations < ActiveRecord::Migration[5.1]
def change
remove_reference :quotations, :job_request, foreign_key: true
end
end
|
require 'httparty'
require 'active_support/all'
module SpyFu
class Configuration
attr_accessor :secret_key, :user_id, :base_url
def initialize
self.secret_key = nil
self.user_id = nil
self.base_url = 'http://www.spyfu.com'
end
end
def self.configuration
@configuration ||= Conf... |
require './test/test_helper'
class ViewDetailsTest < FeatureTest
include Rack::Test::Methods
def setup
post '/sources', PayloadSamples.register_users
PayloadSamples.initial_payloads.each do |payload|
post '/sources/jumpstartlab/data', payload
end
end
def test_user_can_view_all_data_at_homep... |
##
# La classe qui gére l'affichage de la progression de l'utilisateur dans l'aventure
##
# * +win+ La fenêtre de l'application
# * +boite+ Le layout pour placer tous les boutons et afficher l'image de fond
# * +retourMenu+ Bouton permettant de retourner au menu principal
# * +map+ ... |
def display_board(board)
puts " #{board[0]} | #{board[1]} | #{board[2]} "
puts "-----------"
puts " #{board[3]} | #{board[4]} | #{board[5]} "
puts "-----------"
puts " #{board[6]} | #{board[7]} | #{board[8]} "
end
def valid_move?(board, index)
if index.between?(0, 8) && !position_taken?(board, index)
true
else... |
# => Contient la classe FenetreNouvellePartie qui propose le mode aventure ou apprentissage
#
# => Author:: Valentin, DanAurea
# => Version:: 0.1
# => Copyright:: © 2016
# => License:: Distributes under the same terms as Ruby
##
## classe FenetreNouvellePartie
##
class FenetreNouvellePartie < View
... |
=begin
(Understand the Problem)
Problem:
Write a method that takes an Array of numbers, and returns an Array with the same number of elements, and each element has the running total from the original Array.
Inputs: array of numbers
Outputs: array of numbers
Questions:
1.
Explicit Rules:
1. output... |
execute 'gem install rails' do
only_if { platform_family?('windows') }
end
|
require_relative '../test_case'
module RackRabbit
class TestResponse < TestCase
#--------------------------------------------------------------------------
def test_response
response = build_response(200, BODY, :foo => "bar")
assert_equal(200, response.status)
assert_equal("bar", resp... |
class DataDefinitionsController < ApplicationController
before_action :set_data_definition, only: [:show, :edit, :update, :destroy]
# GET /data_definitions
def index
@table_names=DataDefinition.all.collect{|x|x.table_name}.uniq
@tables=[]
@table_names.each {|name|
@tables << {:name=>name, :columns=>Data... |
require "easy_start/version"
require 'active_support/all'
module EasyStart
def self.add(project)
base_data = {'project_name' => '', 'project_path' => ''}
base_data.each do |key,value|
loop do
base_data[key] = project[key]
unless base_data[key].present?
puts "Enter #{key}"
input = gets.ch... |
require './player'
def read_input
if ARGV.empty?
gets
else
val = ARGV.shift
puts val
val
end
end
class CLI
def self.start
new.start
end
def initialize
@players = []
end
def start
@players << get_player(1)
@players << get_player(2)
@current_player_index = rand(@pla... |
require 'spec_helper'
describe "solicitacao_tipos/new" do
before(:each) do
assign(:solicitacao_tipo, stub_model(SolicitacaoTipo,
:tipo => "MyString"
).as_new_record)
end
it "renders new solicitacao_tipo form" do
render
# Run the generator again with the --webrat flag if you want to use we... |
require 'spec_helper'
describe "watch_sites/show" do
before(:each) do
@theStubTeam = stub_model(Team, name:"Seahawks", id:1 )
@theStubVenue = stub_model(Venue, name:"Eat At Joes", id:1)
@watch_site = assign(:watch_site, stub_model(WatchSite,
:name => "hawkers site",
:team => @theStubTeam... |
Rails.application.routes.draw do
get 'comments/create'
get 'comments/distroy'
get 'feed/show'
get 'comments/show_post_comments'
resources :posts
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
root to: redirect('/login')
devise_for :users, path: '', p... |
class CreatePeople < ActiveRecord::Migration
def change
create_table :people do |t|
t.string :title
t.string :intro
t.string :cv
t.string :file
t.timestamps
end
end
end
|
# Find the Duplicates
# Sometimes you need to compare lists of number, but sorting each one normally will take too much time. Instead you can use alternative methods to find the differences between each list. Try to find a faster way to do this challenge than sorting two entire lists.
# Challenge
# Numeros The Artis... |
# Make a dog class
class Dog
attr_accessor :name, :breed
# Shortcut for:
# def name
# @name
# end
# def breed
# @breed
# end
# attr_writer :age
# Shortcut for:
# def age=(new_age)
# @age = new_age
# end
attr_accessor :age, :weight
# Shortcut for:
# attr_reader :age
# attr_write... |
gem 'minitest'
require_relative '../lib/player'
require_relative '../lib/scrabble'
require 'minitest/autorun'
require 'minitest/pride'
require 'pry'
class PlayerTest < Minitest::Test
def setup
@player_1 = Player.new(Scrabble.new)
end
def test_total_score_starts_at_0
assert_equal 0, @player_1.total_score... |
require_relative "lib/user"
require_relative "model/trivia"
require_relative "model/trivia_session"
require_relative "model/trivia_dao"
require_relative "lib/cdn_upload"
require "yaml"
require_relative "lib/rel_cache"
require_relative "lib/db_factory"
require "bcrypt"
namespace :sample do
desc "Say ... |
require 'rails_helper'
RSpec.describe ApplicationHelper, type: :helper do
describe 'full title helper' do
let(:base_title) { 'ピスカティオ' }
context 'case page title is default' do
let(:default_title) { full_title('') }
it 'show title as ピスカティオ' do
expect(default_title).to eq "#{base_title}"... |
class GoodDog
attr_accessor :name, :height, :weight
def initialize(n, h, w)
self.name = n
self.height = h
self.weight = w
end
def change_info(n, h, w)
self.name = n
self.height = h
self.weight = w
end
def info
"#{self.name} weighs #{self.weight} and is #{self.height} tall.... |
# frozen_string_literal: true
HealthQuest::Engine.routes.draw do
namespace :v0, defaults: { format: :json } do
resources :appointments, only: %i[index show]
resources :pgd_questionnaires, only: %i[show]
resources :questionnaire_responses, only: %i[index show create]
get 'apidocs', to: 'apidocs#index... |
# Customise this file, documentation can be found here:
# https://github.com/fastlane/fastlane/tree/master/fastlane/docs
# All available actions: https://docs.fastlane.tools/actions
# can also be listed using the `fastlane actions` command
# Change the syntax highlighting to Ruby
# All lines starting with a # are igno... |
# frozen_string_literal: true
require "concurrent/map"
module Dry
module Logic
def self.Rule(*args, **options, &block)
if args.any?
Rule.build(*args, **options)
elsif block
Rule.build(block, **options)
end
end
class Rule
include Core::Constants
include Dry:... |
Rails.application.routes.draw do
# You can have the root of your site routed with "root"
root 'movies#index'
resources :movies
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.