text stringlengths 10 2.61M |
|---|
require 'spec_helper'
describe "raw_touch_data/edit" do
before(:each) do
@raw_touch_datum = assign(:raw_touch_datum, stub_model(RawTouchDatum,
:phase => 1,
:radius => 1.5,
:timestamp => 1.5,
:x => 1.5,
:y => 1.5
))
end
it "renders the edit raw_touch_datum form" do
rende... |
require 'rails_helper'
RSpec.describe Membership, type: :model do
it { should validate_presence_of(:user) }
it "validates uniqueness of user" do
create(:membership)
should validate_uniqueness_of(:user).scoped_to(:account_id)
end
it { should belong_to(:account) }
it { should belong_to(:user) }
end
|
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Specify Vagrant version and Vagrant API version
Vagrant.require_version ">= 1.6.0"
VAGRANTFILE_API_VERSION = "2"
ENV['VAGRANT_DEFAULT_PROVIDER'] = 'docker'
# Create and configure the Docker container(s)
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
[:up, :reload]... |
module CiscoParser
class IOS
def initialize(io)
@io = io
@hostname = get_hostname
@commands = get_commands
end
def hostname
@hostname
end
def commands
@commands
end
def show_cdp(cmd = "show cdp neighbors detail")
parse_cdp(command_output cmd)
end
... |
# frozen_string_literal: true
module MarkdownMetrics
module Elements
module Inline
class H6 < MarkdownMetrics::Elements::Base
def self.match_element(line, next_line)
line.to_s.match(/^\#{6} .*/)
end
def name
:h6
end
def value
current_l... |
class RemoveSalesPerKilometerFromReport < ActiveRecord::Migration
def up
remove_column :reports, :sales_par_kilometer
end
def down
add_column :reports, :sales_par_kilometer, :integer, :after => :sales
end
end
|
module MessagesHelper
def message_params
params.require(:message).permit(:author_name, :body)
end
end
|
ActiveAdmin.register Word do
permit_params :name, :translation, :displayed, :category_id, :mail
end |
# frozen_string_literal: true
class CreateV2Posts < ActiveRecord::Migration[6.0]
def change
create_table :v2_posts do |t|
t.string :code, null: false
t.string :unit_code, null: false
t.string :zone_code, null: false
t.timestamps
end
add_index :v2_posts, :code, unique: true
add... |
class CreateExoplanets < ActiveRecord::Migration[6.0]
def change
create_table :exoplanets do |t|
t.string :name
t.float :dist_from_earth
t.float :planet_mass
t.timestamps
end
end
end
|
class API::V1::EventsController < ApplicationController
def index
render json: Event.all
end
def show
render json: set_event, serializer: Event::ShowSerializer
end
def create
event = Event.new(event_params)
if event.save
render json: event, serializer: Event::ShowSerializer, status: 20... |
class Book
attr_reader :title,
:author,
:publication_year
def initialize(book_deets)
@title = book_deets[:title]
@author = book_deets[:author_first_name] + " " + book_deets[:author_last_name]
@publication_year = book_deets[:publication_date][-4..-1]
end
end |
# -*- encoding : utf-8 -*-
# == Schema Information
#
# Table name: events
#
# id :bigint(8) not null, primary key
# domain :string(255)
# payload :text(65535)
# type :string(255)
# uuid :string(255)
# created_at :datetime not null
# updated_... |
if Rails.env.development?
task set_annotation_options: :environment do
Annotate.set_defaults(models: true, skip_on_db_migrate: true)
end
task annotate: :set_annotation_options do
AnnotateModels.do_annotations(is_rake: true,
model_dir: %w[app/models],
... |
module Injectable
module InstanceMethods
# Initialize the service with the dependencies injected
def initialize(args = {})
check_missing_arguments!(self.class.required_initialize_arguments, args)
variables_for!(self.class.initialize_arguments, args)
variables_from_dependencies!(args)
s... |
class FavoritesController < ApplicationController
before_action :find_movie, only: [:new, :create]
def new
if logged_in?
@favorite = Favorite.new
else
redirect_to new_session_path
end
end
def create
if logged_in?
@favorite = @movie.favorites.create
@favorite.user_id = c... |
load(File.dirname(__FILE__)+"/base.rb")
class Player < BasePlayer
##CONDITIONS
def ranged_target?
return true if [:wizard, :thick_sludge].include? @target
return true if @target == :archer && can_fight? && @distance_to_target > @@charge_range
false
end
[:ahead, :behind].each do |direction|
@@u... |
class SearchResults
attr_reader :companies,:definitions,:yellow_pages,:acronyms,:findas,:urban_dictionary
def initialize(opts ={})
fail unless opts.is_a? Hash
@companies = opts[:companies] || []
@definitions = opts[:definitions] || []
@yellow_pages = opts[:yellow_pages] || []
@a... |
class Api::V1::QueueJobsController < ApplicationController
def index
@jobs = QueueJob.all
render json: @jobs
end
end
|
# A SwitchGroup is a logical group of Switches. These can be combined
# to form a complex constraint system as in SwitchInterpreter.
#
# Initializing a SwitchGroup will run Minisat in most cases, to find all
# of the possible solutions to that group. This is important because
# those solutions can be interated later fo... |
require 'test_helper'
class DtcsControllerTest < ActionController::TestCase
setup do
@dtc = dtcs(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:dtcs)
end
test "should get new" do
get :new
assert_response :success
end
test "shoul... |
class DropUnnecessaryAttributes < ActiveRecord::Migration
def change
rename_column :statements, :other_cost, :revenue
remove_column :buy_orders, :actual_international_shipping
rename_column :buy_orders, :other_cost, :cash_back
end
end
|
require 'rails_helper'
require 'faker'
RSpec.describe EmployersContractClaim, type: :model do
let(:four_thousand_five_hundred_and_one_characters) { Faker::Lorem.characters(4501) }
let(:populated_employers_contract_claim) {
described_class.new(
make_employer_contract_claim: true, claim_information: 'lor... |
require 'rubygems'
gem 'jeweler', '>= 1.4.0'
require 'rake'
require 'yaml'
$:.unshift File.expand_path(File.join(File.dirname(__FILE__),'lib'))
require 'rake/rdoctask'
require 'rspec/rails/version'
begin
require 'jeweler'
Jeweler::Tasks.new do |gem|
gem.name = "rspec-rails"
gem.version = Rspec::Rails::Ve... |
class AddNoToDestination < ActiveRecord::Migration
def change
add_column :destinations, :mmsinumber, :string
end
end
|
# == Schema Information
# Schema version: 20090607171906
#
# Table name: votes
#
# id :integer(4) not null, primary key
# user_id :integer(4)
# issue_id :integer(4)
# created_at :datetime
# updated_at :datetime
# value :integer(4)
#
# Schema info: 20090607170409_create_votes
#
# Table name... |
# frozen_string_literal: true
require 'faker'
require 'factory_bot_rails'
include(CompetitionHelper)
Ladder.create(name: 'Bronze')
Ladder.create(name: 'Silver')
Ladder.create(name: 'Gold')
Ladder.create(name: 'Platinum')
Ladder.create(name: 'Diamond')
Achievement.create(name: 'My Name Is Achilles', description: 'You... |
require 'spec_helper'
module Models
describe MenuCategory do
let(:menu_item) { FactoryGirl.create(:menu_item) }
before do
@menu_category = MenuCategory.create(name: sample_categories.first)
@menu_category.add_item(menu_item)
end
specify { expect(@menu_category).to respond_to(:name) }
... |
require 'spec_helper'
describe NotesController do
describe "index" do
it "assigns all notes" do
note1 = Note.new(:title => "one", :user_id => NotesController::USER_ID)
note2 = Note.new(:title => "two", :user_id => NotesController::USER_ID)
NoteRepository.save(note1)
NoteRepository.save(n... |
require 'haml_lint_auto_corrector'
require 'rainbow/ext/string'
module HamlLintAutoCorrector::Log
module Progress
def self.create_log(msg)
Rainbow(msg).white
end
end
end
|
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Ch... |
require 'rails_helper'
RSpec.describe "Routing to the application", :type => :routing do
it "GET / routes to games#index" do
expect(get: "/").to route_to("games#index")
end
it "GET /games/:id routes to games#show" do
expect(get: "/games/1").to route_to(controller:'games', action: 'show', id:'1')
end
e... |
require_relative('venue')
require_relative('room')
require_relative('guest')
require_relative('song')
@venue = Venue.new
@menu1 = "
MENU 1 (type number to select)
- 0 Exit
- 1 Create Room
- 2 View Existing Rooms"
@menu2 = "MENU 2 (type number to select)
- 0 MENU BACK
- 1 Remove Room
- 2 Check-In Guest
... |
name "my_environment"
description "A role to configure my working computers (home PC, work PC, laptop)"
run_list "recipe[ntp]", "recipe[user_dmitry]", "recipe[wheel]"
default_attributes(
"ntp" => {
"servers" => ["ntp.nic.cz", "ntp.utwente.nl"]
},
"wheel" => {
"members" => ["dmitry", "pi"]
... |
class AddAbbreviationToEpic < ActiveRecord::Migration
def change
add_column :epics, :abbreviation, :string
end
end
|
# frozen_string_literal: true
module GraphQL
class Schema
# A possible value for an {Enum}.
#
# You can extend this class to customize enum values in your schema.
#
# @example custom enum value class
# # define a custom class:
# class CustomEnumValue < GraphQL::Schema::EnumValue
#... |
# Service for analyzing instagram posts
class EventAnalyzeService
attr_reader :event, :instagram_service
def initialize(args = {})
@event = args[:event]
@instagram_service = InstagramService.new(token: event.user.token)
end
# receive likes for post and update Event
def receive_like... |
require 'spec_helper'
describe QueueItemsController do
context "with authenticated user" do
let(:user) { Fabricate(:user) }
before do
session[:user_id] = user.id
end
describe "GET index" do
it "renders the index template" do
get :index
expect(response).to render_tem... |
require 'date'
###
# Compass
###
# Change Compass configuration
# compass_config do |config|
# config.output_style = :compact
# end
###
# Page options, layouts, aliases and proxies
###
# Per-page layout changes:
#
# With no layout
# page "/path/to/file.html", :layout => false
#
# With alternative layout
# page "/p... |
class Balancer
def balance(paths)
movecount = ideal_length(paths) - 1
unused = find_unused(paths)
unused.each do |path|
largest = find_largest(paths)
# split this path
path.concat(largest.pop(movecount))
end
return paths
end
def find_unused(paths)
paths.select { |path| p... |
class CreateMessageSends < ActiveRecord::Migration
def change
create_table :message_sends do |t|
t.string :sid
t.datetime :date
t.text :from_phone
t.text :to_phone
t.text :body
t.text :status
t.timestamps
end
end
end
|
class DetailsPresenter
def temporal(hash)
if hash && hash['RangeDateTime']
# some collections may have multiple temporal fields when retrieved in echo10 format. CMR returns the date time
# from elasticsearch where latest and earliest times are indexed.
if hash['RangeDateTime'].is_a? Array
... |
Rails.application.routes.draw do
root 'buildings#index'
resources :buildings
resources :apartments
end
|
class AddTwitterAndRedditUsernameToBooks < ActiveRecord::Migration[5.0]
def change
add_column :books, :reddit_username, :string
add_column :books, :twitter_username, :string
end
end
|
module Batsd
#
# Abstract interface for handling different types of data
# (e.g., counters, timers, etc.).
#
# Generally, this should be subclassed to provide the specific
# functionality desired. If left unmodified, it provides an echo
# handler when run with <code>ENV["VVERBOSE"]</code>, and is silen... |
module Error
# ErrorHandler contains the logic for handling exceptions in controllers
module ErrorHandler
def self.included(clazz)
clazz.class_eval do
rescue_from StandardError do |exception|
if ENV['RACK_ENV'] == 'development'
json_response('Internal Error', exception, 500)
... |
require 'strscan'
module Flair
# The Lexer for Flair. This will take a string and convert
# it to tokens for parsing.
class Lexer
KEYWORDS = ["if", "class", "id", "true", "false", "nil"]
REGEX = {
:identifier => /\A([a-z]\w*[-]?\w*)/,
:constant => /\A([A-Z]\w*)/,
:number => /\A([0-9]+... |
class UsersSubsRelationship < ApplicationRecord
validates :user_id, presence: true
validates :subscription_id, presence: true
belongs_to :user
belongs_to :subscription
end
|
class User
attr_reader :username, :password
def initialize(options)
@username = options[:username]
@password = options[:password]
end
end
|
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe User, type: :model do
it 'is invalid without a name' do
user = FactoryBot.build(:user, name: nil)
user.valid?
expect(user.errors[:name]).to include('を入力してください')
end
it 'is invalid without a email' do
user = FactoryBot.build(:u... |
@users.each do |user|
json.set! user.id do
json.extract! user, :id, :username, :name
json.avatar asset_path(user.avatar.url(:medium))
json.photos({})
# json.photos do
# user.photos.each do |photo|
# json.set! photo.id do
# json.id photo.id
# json.urlMedium asset_path(... |
class User < ActiveRecord::Base
include BCrypt
has_many :likes
has_many :items, through: :likes
has_many :comments
has_attached_file :photo
validates_attachment_content_type :photo, content_type: /\Aimage\/.*\Z/
def password
@password ||= Password.new(password_hash)
end
def password=(new_password)
@... |
# encoding: utf-8
# Copyright 2014 Square Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... |
module Dotpkgbuilder
class Bom < Stage
BOMFILE = "Bom".freeze
delegate :pkg_dir, :source_dir, to: :context
def run
mkbom
end
def mkbom
bom_file = File.join(pkg_dir, BOMFILE)
log.info "creating #{bom_file}"
sh "mkbom #{source_dir} #{bom_file}"
end
end
end
|
ENV['RAILS_ENV'] = 'test'
require 'spec_helper'
require File.expand_path('../../config/environment', __FILE__)
abort("The Rails environment is running in production mode!") if Rails.env.production?
require 'rspec/rails'
require 'sidekiq/testing'
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
A... |
require_relative '../spec_helper'
%w{openssh openssh-clients openssh-server}.each do |package|
describe package(package) do
it { should be_installed }
end
end
describe service('sshd') do
it { should be_enabled }
it { should be_running }
end
describe port(22) do
it { should be_listening }
end
|
# Model holds logic for multiple fee receipt templates
# A receipt template comprise of
# name : template name,
# header_content : html content to be embedded for receipt header - A4 (mandatory)
# ... |
--------------------------------------
PEDAC process
1. Problem
Understand the problem
• Identify input and output
• Make the requirements explicit
• Identify rules
• Mental model of the problem (optional)
2. examples/test cases
• Validate understanding the problem
3. Data structure
• How we represent data that we wi... |
class WavTap < Cask
url 'https://github.com/downloads/pje/WavTap/WavTap%200.2.0.pkg'
homepage 'https://github.com/pje/wavtap'
version '0.2.0'
sha1 '9d71dcf769dd546d66278dc9cbf675df6b006fe6'
end
|
class Offer < ApplicationRecord
belongs_to :professional, class_name: 'User'
belongs_to :category
end
|
class AddRememberDigestToUsers < ActiveRecord::Migration[5.0]
def up
add_column :users, :remember_digest, :string
end
def down
end
end
|
class Tweet < ActiveRecord::Base
def self.fetch
json = JSON.parse RestClient.get(CONFIG["api_url"] + "/tweets.json")
json.map do |t|
tweet = self.find_by_message_id(t["id"])
if tweet
tweet.counter+=1
tweet.save!
else
self.create!({
created_at: t["create... |
class CreateCaracteristicas < ActiveRecord::Migration
def change
create_table :caracteristicas do |t|
t.references :servicio, index: true, foreign_key: true
t.string :descripcion
t.boolean :estatus
t.float :costo
t.timestamps null: false
end
end
end
|
require 'rails_helper'
RSpec.describe Stat, type: :model do
describe "validations" do
it "is valid with all valid attributes" do
team = Team.create(name: "Brett's Team")
player = team.players.create(first_name: "Brett", last_name: "Schwartz", position: 0, nfl_team:"Jets")
stat = player.stats.cr... |
require_relative "todo_storage_generator"
require_relative "todo_list"
MODES = [
"list",
"append",
"update",
"remove",
"search"
]
sg = TodoStorageGenerator.new(ENV["STORAGE"])
errs = sg.errs
if !errs.empty?
puts errs.join
return
end
strage = sg.generate
list = TodoList.new(strage)
loop do
begin
p... |
# encoding: UTF-8
require File.join(File.dirname(__FILE__),'test_helper')
class MemoryTest < Minitest::Test
def memory(image = 'sample.png')
data = image_data(image)
FreeImage::Memory.new(data)
end
def test_wrap
refute_nil(memory)
end
def test_format
assert_equal(:png, memory.format)
end
... |
# == Schema Information
#
# Table name: water_source_reports
#
# id :integer not null, primary key
# user_id :integer
# reporter_name :string
# location :string
# lat :decimal(, )
# lng :decimal(, )
# water_condition :integer
# water_type :inte... |
module IQ::Upload::Base
# Name of directory/path under which uploaded files will be available. (based on class name and storage directory)
# MyAsset < ActiveRecord::Base
# MyAsset.asset_dir => 'public/assets/my_assets'
#
# MyImage < MyAsset
# MyImage.asset_dir => 'public/assets/my_images'
def asse... |
require 'rails_helper'
RSpec.describe "products/show", type: :view do
before(:each) do
@product = assign(:product, Product.create!(
:id => "",
:name => "Name",
:harga => "",
:keterangan => "MyText",
:is_active => false,
:views => "",
:user_id => "",
:picture_id => ... |
require "rulers/version"
require "rulers/routing"
require "rulers/utils"
require "rulers/dependencies"
require "rulers/controller"
require "rulers/file_model"
require "rulers/sqlite_model"
module Rulers
class Application
def call(env)
if env['PATH_INFO'] == '/favicon.ico'
return [404, {'Content-... |
class Role
attr_accessor :name
def initialize options = {}
name = options[:name].to_sym
raise ArgumentError, "Not a valid role label, was: #{name}" if !name.kind_of_label?
@name = name
role = self if !Role.exists?(@name)
Role.roles << role if role
end
class << self
def all
r... |
class District < ActiveRecord::Base
include UUIDHelper
nilify_blanks
set_primary_key :uuid
belongs_to :constituency, :primary_key => 'uuid', :foreign_key => 'constituency_uuid'
belongs_to :member, :primary_key => 'uuid', :foreign_key => 'member_uuid'
belongs_to :previous, :class_name => "District", :prima... |
class ArticlesController < ApplicationController
before_filter :safecheck,:except=>[ :show ,:index]
def safecheck
if !session[:user_name].nil? then
return true;
end
else
redirect_to "/"
return false
end
def show
@article = Article.find(params[:id])
end
def edit... |
class Joke
def initialize(joke)
@joke = joke
end
def question
@joke[:question]
end
def answer
@joke[:answer]
end
def id
@joke[:id]
end
end
|
class ChangeStatusInUserPositions < ActiveRecord::Migration[5.2]
def change
remove_column :user_positions, :status, :string
add_column :user_positions, :status, :string, default: "pending"
end
end
|
class OrdersController < ApiController
before_action :set_user
def index
orders = @user.orders.where(status:1)
render json: each_serialize(orders)
end
def create
orders = @user.orders.create(order_params)
render json: orders
end
def update
order_id = @user.orders.last.id
orders =... |
# frozen_string_literal: true
module Vedeu
module Presentation
# Provides colour related presentation behaviour.
#
# @api private
#
module Colour
include Vedeu::Presentation::Parent
# When the background colour for the model exists, return it,
# otherwise returns the parent ... |
class UserSerializer < ActiveModel::Serializer
attributes :id, :email, :first_name, :last_name, :image_url, :bird_ids
has_many :birds
has_many :stats
end
|
class Settings < Settingslogic
source "#{Rails.root}/config/application.yml"
namespace Rails.env
# TODO: Mix in all of the ENV variables for secrets, etc.
Settings['sidekiq'] ||= Settingslogic.new({})
Settings['sidekiq']['max_retries'] ||= 10
Settings['sidekiq']['url'] ||= 'redis://localhost:6379'
Settin... |
class AddressForm < Rectify::Form
attribute :firstname, String
attribute :lastname, String
attribute :address, String
attribute :city, String
attribute :zipcode, String
attribute :phone, String
attribute :addressable_type, String
attribute :country_i... |
Qiankun::Org.controllers :organizes do
layout Padrino.root("app","views","application.haml")
get :index do
@title = "Organizes"
@organizes = Organize.all
render 'organizes/index'
end
get :new do
@title = pat(:new_title, :model => 'organize')
@organize = Organize.new
render 'organizes... |
class IncomingEmail < ActiveRecord::Base
#NOT_TESTED
#FIXME account n'a pas has_many incoming_emails est ce que cette relation sert a quelque chose (et l'index ?)
#FIXME incoming_emails.candidate_id est ce utilisé ? et candidate.rb n'a pas has_many incoming_emails
belongs_to :mission
belongs_to :account
h... |
Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
resources :answers
resources :choices
resources :questions
resources :chapters
resources :topics
resources :subjects
resources :exams do
get :get_details, :on => :coll... |
require 'test/unit'
require 'minitest/reporters'
MiniTest::Reporters.use!
class Proc
def self.current_handler(an_exception_handler)
@handler = an_exception_handler
end
def self.handle(an_exception)
@handler.handle an_exception
end
def call_handling(an_exception_class,&handler)
return_closure =... |
require './spec/helper'
describe HtmlFilesWriter do
let(:coverage_dir) { 'coverage' }
let(:config) { {theme: 'light', output_directory: 'coverage'} }
it "writes all files" do
HtmlFilesWriter.new({'a' => 'azerty', 'q' => 'qwerty'}, config).write
expect(File).to exist("#{coverage_dir}/css/coco.css")
... |
json.array!(@matchings) do |matching|
json.extract! matching,
json.url matching_url(matching, format: :json)
end |
# frozen_string_literal: true
require "pathname"
require "ruby-next"
require "ruby-next/utils"
require "ruby-next/language"
require "ruby-next/language/eval"
module RubyNext
module Language
runtime!
# Module responsible for runtime transformations
module Runtime
using RubyNext
class << se... |
require 'exifr'
require 'blitline'
require 'open-uri'
#from homeland console
#require '<PATH TO>/blitline_test.rb'
#BlitlineTest.do_the_needfull
#will process all images in the local folder
class ImageProcessor
@cover_image_drop_path = AppConstants::COVER_IMAGE_DROP_PATH
@image_qualities = AppConstants::SELECTAB... |
module VimeoId
REGEX = /(vimeo\.com|channels|videos|video)(?:\/)(?<id>\d+)/
end
|
class FriendshipsController < ApplicationController
def index
@friends = current_user.friends.page(params[:page_1]).per(24)
@friend_requests_received = FriendRequest.where(receiver_id: current_user.id).page(params[:page_2]).per(24)
@friend_requests_sent = FriendRequest.where(user_id: current_user.id).page... |
class User < ApplicationRecord
belongs_to :disc
has_many :users
end
|
require 'spec_helper'
describe "Teams" do
test_file = File.new("public/images/calendar.png")
before(:each) do
user = FactoryGirl.create(:user)
visit "/#{I18n.locale}/users/sign_in"
fill_in "user_username", :with => user.username
fill_in "user_password", :with => user.password
click_button
... |
# Your code here
#spec/calculator_spec.rb
require 'spec_helper'
require 'calculator'
describe Calculator do
let(:calculator){Calculator.new}
describe '#add' do
it 'returns the sum of its arguments' do
expect(calculator.add(1,2)).to eq(3)
end
it 'returns the sum of a negative integer and posit... |
class EventSourceController < ApplicationController
include ActionController::Live
def projected
response.headers['Content-Type'] = 'text/event-stream'
sse = ActiveEvent::SSE.new(response.stream)
ActiveEvent::EventSourceServer.wait_for_event_projection event_id, projection, timeout: 10
sse.event 'p... |
require './spec/helpers'
include GameEngine
describe 'Game' do
let(:game){Game.new}
it { game.start.table.set.count.should eq(6)}
it { game.start.pocket.set.count.should eq(0)}
it 'should be able to roll the dices in the table set' do
mocked_table_set = double("dice_set")
mocked_table_set.should_rec... |
# Generate a pair of directory and file
# like "app/models/#{model_name}/#{partial_name}.rb"
class PartialModelGenerator < Rails::Generators::Base
source_root File.expand_path('../templates', __FILE__)
argument :model_name, type: :string
argument :partial_name, type: :string
def generate_partial_model
@m... |
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Ch... |
module Magick
module ExtractObject
class Config
attr_accessor :slope, :mask_color, :content_type
def initialize
@slope = 10_000_000
@mask_color = "red"
@content_type = []
end
end
end
end
|
module Travis
module WebLint
class Error < StandardError
def type?(type)
self.type == type
end
def type; end
end
class HTTPError < Error; def type; :http end end
class JSONError < Error; def type; :json end end
class YAMLError < Error; def type; :yaml end end
... |
class MessagesController < ApplicationController
def create
@message = Message.create(message_params)
if @message.save
flash[:success] = "Thanks for contacting the support team #{@message.name}, We will get back to you in no time."
redirect_to root_path
else
flash[:danger] = "Request could not be submi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.