text stringlengths 10 2.61M |
|---|
require 'rspec'
require 'rules/ca/on/minimum_weekly_hours'
require 'rules/base'
module Rules
module Ca
module On
describe MinimumWeeklyHours do
describe 'processing' do
context 'when activity is goes beyond minimum weekly hours' do
subject { MinimumWeeklyHours.check(41.0, 40.0... |
class MetroArea < ActiveRecord::Base
has_many :freecycles
end
|
require 'rails_helper'
RSpec.describe 'Routes', :type => :routing do
it 'uses GET / to show homepage' do
expect(:get => '/')
.to route_to(
controller: 'static_pages',
action: 'home'
)
end
it 'uses GET /sigunp to sign up' do
expect(:get => '/signup')
.to route_to(
... |
# typed: strict
# frozen_string_literal: true
module Packwerk
class PrivacyChecker
extend T::Sig
include Checker
sig { override.returns(Packwerk::ViolationType) }
def violation_type
ViolationType::Privacy
end
sig do
override
.params(reference: Packwerk::Reference)
... |
class AddColumnsToContents < ActiveRecord::Migration[5.2]
def change
add_column :contents, :url, :text
add_column :contents, :embed, :text
add_column :contents, :tag_info, :text
add_column :contents, :duration_int, :integer
add_column :contents, :duration_str, :string
add_column :contents, :pu... |
class CreatePeerAllies < ActiveRecord::Migration
def up
create_table 'peer_allies' do |t|
t.string 'name'
t.string 'grade'
t.text 'bio'
end
end
def down
drop_table 'peer_allies' # deletes the whole table and all its data!
end
end
|
class EbayAPI
scope :sell do
scope :inventory do
scope :locations do
operation :delete do
path { merchant_location_key }
option :merchant_location_key
http_method :delete
response(204) { true }
response(404) { nil }
end
end
end
en... |
class Benchmark
class << self
def decimal_formatter
@_decimal_formatter ||= Potion::DecimalFormat.new("#,###,###")
end
def total_run
@total_run
end
def run_single(setup_desc, code_desc, iterations, &block)
@total_run ||= 0
start_time = Time.milliseconds_since_epoch
... |
require 'test_helper'
class MembershipTest < UnitTest
describe "valid membership data" do
it "wont save a membership without a member" do
membership = build(:individual_membership)
membership.save.must_equal false
end
it "associates a member with a membership" do
member = create(:mem... |
Rails.application.routes.draw do
root to: "shortened_urls#index"
resources :shortened_urls
end
|
class AddLinkedInProfileUrlToScholarships < ActiveRecord::Migration
def change
add_column :scholarships, :linked_in_profile_url, :text
end
end
|
class RecommendationRequest < RecommendationRequest.superclass
module Cell
class UnresolvedAlert < Abroaders::Cell::RecommendationAlert
property :unresolved_recommendation_requests
# @param account [Account] the currently logged-in account. Must have at
# least one unresolved rec request - err... |
class Admin::SubscribersController < Admin::AdminController
before_action :authorize
before_action :set_subscriber, only: [:show, :edit, :update, :destroy]
# /admin/subscribers
def index
@subscribers = Subscriber.page(params[:page])
@title = admin_title
end
# /admin/subscribers/1
def show
@t... |
class CreateConstellations < ActiveRecord::Migration[6.0]
def change
create_table :constellations do |t|
t.string :name
t.string :symbol
t.string :element
t.string :ruling_planet
t.string :zodiac_quality
t.string :start_date
t.string :end_date
end
end
end
|
# Implementation of {Metasploit::Model::Module::Rank} to allow testing of {Metasploit::Model::Module::Rank}
# using an in-memory ActiveModel and use of factories.
class Dummy::Module::Rank < Metasploit::Model::Base
include Metasploit::Model::Module::Rank
#
# Attributes
#
# @!attribute [rw] name
# The na... |
class AddCohortToTopApplicants < ActiveRecord::Migration[5.2]
def change
add_reference :applicants, :cohort, index: true, foreign_key: { on_delete: :cascade }
reversible do |dir|
dir.up do
cohort = TopCohort.create!(name: "Convocatorias Pasadas")
TopApplicant.update_all(cohort_id: cohor... |
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_filter :set_global_vars
private
def set_global_vars
@company_name = 'Rivendell Education Company'
@phone_number = '952-996-1451'
@inquiry_email = 'inquiries@rivendelleducation.com'
@twitte... |
Write a method that takes an integer argument, and returns an Array of all integers, in sequence, between 1 and the argument.
You may assume that the argument will always be a valid integer that is greater than 0.
Examples:
sequence(5) == [1, 2, 3, 4, 5]
sequence(3) == [1, 2, 3]
sequence(1) == [1]
Question:
Write a... |
class SummaryController < ApplicationController
def index
@summary = Summary.new
if params[:maximum_margin]
maximum_margin = params[:maximum_margin].to_f
@summary.set_maximum_margin(maximum_margin)
end
end
end
|
STATUS = YAML.load_file(Rails.root.join('config/locales/statuses.yml'))
class ModesController < ActionController::API
def index
modes = Mode.all
render json: { status: STATUS['success'], message: 'Loaded modes', data: modes }
end
def show
mode = Mode.find(params[:id])
render json... |
class HasContainerPathsValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
return unless value.present?
value.each do |volume|
next if volume['container_path'].present?
record.errors[attribute] << "container path can't be blank"
break
end
end
end
|
class ProductsController < ApplicationController
def index
@products = Product.all
end
def new
@product = Product.new
end
def show
@product = Product.find(product_id)
end
def edit
@product = Product.find(product_id)
render :new
end
def create
product_params = params.require(:product).permit(:ti... |
# frozen_string_literal: true
module RudderAnalyticsSync
VERSION = '1.0.7'
end
|
class AddCreateUserRefToForwarder < ActiveRecord::Migration
def change
add_reference :forwarders, :create_user, index: true
end
end
|
class AddUserToGif < ActiveRecord::Migration[5.2]
def change
add_reference :gifs, :user, foreign_key: true
end
end
|
module ControllerScopeHelpers
extend ActiveSupport::Concern
module UserSessions
extend ActiveSupport::Concern
included do
helper_method :current_session, :current_user
end
protected
def current_session
return @current_session if defined?(@current_session)
@curre... |
## subjects data table
class Subjects < ActiveRecord::Migration[6.0]
def change
def self.up
create_table :subjects do |t|
## fields for subjects table
t.column :name, :string
end
## premade entries for subjects table
Subject.create :name => "Chemistry"
Subject.creat... |
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe PagesController, type: :controller do
let(:user) { create(:user) }
describe 'GET #index' do
it 'renders index page' do
get :index
expect(response).to render_template :index
end
it 'redirects logged in user to dashboard' d... |
class NewsLease < ApplicationRecord
belongs_to :user
belongs_to :category
belongs_to :place, optional: true, dependent: :destroy
belongs_to :image, optional: true, dependent: :destroy
accepts_nested_attributes_for :place, allow_destroy: true, update_only: true
accepts_nested_attributes_for :image, all... |
class ChangeDatatypeWeekdayTextOfSpots < ActiveRecord::Migration[5.0]
def change
change_column :spots, :weekday_text, :string
end
end
|
require 'test_helper'
feature 'Check a theme has been applied' do
scenario 'Theme is loaded', js: true do
# Given that Zurb's Foundation is installed
# When I visit the root page
visit root_path
# Then the theme is applied because I identify an ad-hoc hidden class
page.must_have_css('div.theme_... |
class AddWmsSchema < ActiveRecord::Migration
def self.up
ActiveRecord::Schema.define(version: 20160412144600) do
create_table "message", primary_key: "message_id", force: :cascade do |t|
t.string "name", limit: 80, null: false
t.integer "package_group_... |
class SearchMessagesQuery < Types::BaseResolver
description "Searches messages using the provided query"
argument :query, String, required: true
type [Outputs::MessageType], null: true
policy ApplicationPolicy, :logged_in?
def authorized_resolve
MessageSearch.new(query: input.query, user: current_user).r... |
class Api::V1::Customers::MerchantsController < ApplicationController
def show
@merchant = customer.favorite_merchant
render :partial => 'partials/merchants/_show'
end
end
|
class PostSerializer < ActiveModel::Serializer
attributes :id, :commodity_id, :date_needed, :date_posted, :priority
belongs_to :user
belongs_to :commodity
end
|
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
def facebook
# You need to implement the method below in your model (e.g. app/models/user.rb)
@user = User.find_for_facebook_oauth(request.env["omniauth.auth"], current_user)
if @user.present?
flash[:notice] = I18n.t "... |
#!/bin/env ruby
# frozen_string_literal: true
require 'json'
require 'nokogiri'
require 'pry'
require 'scraped'
require 'scraperwiki'
require 'open-uri/cached'
OpenURI::Cache.cache_path = '.cache'
class MemberList < Scraped::JSON
field :members do
json[:dados].map { |m| fragment(m => Member).to_h }
end
fi... |
require 'spec/spec_helper.rb'
require 'lib/rest/request.rb'
describe FacebookApiCore::Rest::Response do
before(:all) do
end
before(:each) do
end
it "should initialize the Response object" do
@http_response = mock(Net::HTTPResponse, :code => "200", :body => '<?xml version="1.0" encoding="UTF-8"?>... |
#!/usr/bin/env ruby
gem 'minitest', '>= 5.0.0'
require 'minitest/autorun'
require_relative 'run_length_encoding'
# Common test data version: 503a57a
class RunLengthEncodingTest < Minitest::Test
def test_empty_string
input = ''
output = ''
assert_equal output, RunLengthEncoding.encode(input)
end
def... |
# 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... |
class LikesController < ApplicationController
before_filter :signed_in_user
def create
@photo = Photo.find(params[:id])
@user_likes = Like.where(photo_id: @photo.id)
@like = current_user.likes.create(user_id: current_user.id, photo_id: params[:id])
if @like.save
respond_to do |format|
... |
#!/usr/bin/env ruby
require 'lib/selenium_viewpointsbase'
class LoggedInTests < Selenium::ViewpointsBase
def test_login
login
@sel.open("/")
@sel.wait_for_page_to_load(10000)
assert(@sel.is_text_present("log off"), 'Session not logged in, but should be')
# this text is ajaxed in, and d... |
# The contents of this file are subject to the terms
# of the Common Development and Distribution License
# (the License). You may not use this file except in
# compliance with the License.
#
# You can obtain a copy of the License at
# https://opensso.dev.java.net/public/CDDLv1.0.html or
# opensso/legal/CDDLv1.0... |
class User < ApplicationRecord
validates :password, presence: true, length: { minimum: 6 }
acts_as_authentic do |c|
c.crypto_provider = Authlogic::CryptoProviders::Sha512
end
end
|
# == Schema Information
#
# Table name: deployment_pipelines
#
# id :integer not null, primary key
# created_at :datetime not null
# updated_at :datetime not null
# name :string indexed
# env_id :integer
# position :integer
# template :boolean ... |
module Movies
module UseCases
class Delete < UseCase::Base
def persist
MovieRepository.new.destroy_movie(params[:id])
end
end
end
end
|
#!/usr/bin/env ruby
require 'metrobus'
route_name = ARGV[0]
stop_name = ARGV[1]
direction = ARGV[2]
def bail(message)
puts message
exit 1
end
found_routes = Metrobus::Route.find(route_name)
if found_routes.length == 0
bail("No routes were found for #{route_name}")
elsif found_routes.length > 1
message = "F... |
# Public: Checks wether or not an Integer is even or not.
#
# num - The Integer that will be checked.
#
# Examples
#
# is_even(7)
# # => false
#
# Returns if the Integer was even or not.
def is_even(num)
if num % 2 == 0
return true
else
return false
end
end |
class UserMailer < ActionMailer::Base
default_url_options[:host] = configus.mailer.default_host
default from: configus.mailer.default_from
def confirm_registration(user, token)
@user = user
@token = token
mail :to => @user.email
end
def remind_password(user, token)
@user = user
@token = ... |
class Post < ActiveRecord::Base
include Voteable
include Sluggable
belongs_to :creator, foreign_key: 'user_id', class_name: 'User'
has_many :comments
has_many :post_categories
has_many :categories, through: :post_categories
validates :title, presence: true, length: {minimum: 3}
validates :url, uniqueness: tru... |
require 'test_helper'
class AnalyzeDatasetJobTest < ActiveJob::TestCase
setup do
@report = create(:report)
end
test 'run analyze dataset job' do
AnalyzeDatasetJob.perform_now(@report)
assert_empty @report.stderr
assert_nil @report.error
assert_equal 'finished', @report.status
assert @rep... |
class JarvisController < ApplicationController
skip_before_action :verify_authenticity_token
def command
msg = case parsed_message
when Hash
@responding_alexa = true
slots = parsed_message&.dig(:request, :intent, :slots)
[slots&.dig(:control, :value), slots&.dig(:device, :value)].compact.... |
class ParkingSlotReservation < ApplicationRecord
belongs_to :user
belongs_to :parking_slot
before_save :set_is_paid
after_find :set_total_time
attr_accessor :total_time
scope :client_paid, -> (number_plate) { where(number_plate: number_plate, is_paid: true).sum(:subtotal) }
scope :client_paid_month, ->... |
# frozen_string_literal: true
require 'tempfile'
require 'file_kv_store'
RSpec.shared_examples 'KV store' do
it 'allows you to fetch previously stored values' do
kv_store.store(:language, 'Ruby')
kv_store.store(:os, 'linux')
expect(kv_store.fetch(:language)).to eq 'Ruby'
expect(kv_store.fetch(:os)).... |
class Job < ActiveRecord::Base
has_many :applicants, dependent: :destroy
validates :name, presence: true
end
|
class EasyResourceAvailability < ActiveRecord::Base
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
validates_presence_of :date
scope :for_timeline, lambda {|uuid, start_date, end_date| {
:conditions => ["#{EasyResourceAvailability.table_name}.easy_page_zone_module_uuid = ? AND #{E... |
# frozen_string_literal: true
# To-do: make a header file with all constant
# definition for all the elements
module Relax
# This module helps generating
# an svg image founded on
# https://www.w3.org/TR/SVG2/
module SVG
XMLNS = 'http://www.w3.org/2000/svg'
CORE_ATTRIBUTES = %i[
element_id
... |
class Api::V1::ArticlesController < ActionController::Base
before_action :set_article, only: %i[show]
def top
top_article = Article.where(kind: 0).last
render json: top_article, serializer: Article::ShortSerializer
end
def headline
head_articles = Article.where(kind: 1).last(3)
render json: he... |
require 'test_helper'
describe EpisodeItem do
it 'has a valid fixture instance' do
@item_one.must_be :valid?
end
it 'belongs to an Episode' do
assert_equal @episode_one, @item_one.episode
end
it 'is not deleted on destroy' do
assert_no_difference 'EpisodeItem.count' do
@item_destroyable.... |
feature "homepage" do
scenario "user sees welcoming message" do
visit('/')
expect(page).to have_content "Welcome to Messaging World:"
end
scenario "Only the 20 first characters of the message are displayed" do
post_message
expect(page).to have_content("Hello, how are you to")
expect(page).not... |
class RegistrationController < Devise::RegistrationsController
def sign_up_params
params.require(:user).permit(:email, :username, :password)
end
def sign_in_params
params.require(:user).permit(:email, :password)
end
end |
require 'wordpress-xmlrpc-api'
module Timeline
class Wordpress
include Import
def initialize options
@url = options['url']
@username = options['username']
if options.key? 'excluded_categories' then
@excluded_categories = options['excluded_categor... |
require 'rails_helper'
RSpec.describe "Index Store", type: :feature do
context "User is logged in" do
before(:each) do
@current_user = FactoryBot.create(:user)
login_as(@current_user, :scope => :user, :run_callbacks => false)
@store = FactoryBot.create(:store, user: @current_user)
vis... |
class Project
attr_reader :backers, :title
def initialize(title)
@backers = []
@title = title
end
def add_backer(backer_inst)
check=@backers
if check.any?(backer_inst)
puts "already backed"
else
@backers << backer_inst
b... |
module PryParsecom
class Table
attr_accessor :indent
def initialize heads, indent=' ', rows=[]
@heads = heads
@indent = indent
@col_widths = Hash.new 0
@heads.each do |head|
@col_widths[head] = head.size
end
self.rows = rows
end
def rows= rows
@rows... |
class Item
@@list = []
attr_reader :id, :rank
attr_accessor :name
def initialize(attributes)
@name = attributes.fetch(:name)
@rank = attributes.fetch(:rank)
@id = @@list.length + 1
end
def self.all()
@@list
end
def save()
@@list.push(self)
end
def self.clear()
@@list = ... |
# == Schema Information
#
# Table name: songs
#
# id :integer not null, primary key
# artist_id :integer
# album_id :integer
# name :string(255)
# created_at :datetime not null
# updated_at :datetime not null
#
require 'spec_helper'
describe Song do
subject(:song) {cr... |
require 'rails_helper'
RSpec.describe Transaction, type: :model do
it "has a valid factory" do
expect(FactoryGirl.build(:transaction)).to be_valid
end
subject(:transaction) { FactoryGirl.build(:transaction) }
describe "ActiveModel validations" do
it { is_expected.to validate_presence_of(:amount) }
... |
class CoursePolicy < Struct.new(:user, :course)
def index?
user
end
def show?
course.users.include? user
end
def settings?
course.admins.include? user
end
def update?
settings?
end
def update_attending?
course.owners.include? user
end
def send_invitation?
settings?
e... |
# == Schema Information
#
# Table name: favorites
#
# id :integer not null, primary key
# created_at :datetime not null
# updated_at :datetime not null
# novel_id :integer
# user_id :integer
#
# Indexes
#
# index_favorites_on_novel_id (novel_id)
# index_favorite... |
# frozen_string_literal: true
require 'faraday'
require 'vmfloaty/http'
require 'json'
require 'vmfloaty/errors'
class Pooler
def self.list(verbose, url, os_filter = nil)
conn = Http.get_conn(verbose, url)
response = conn.get 'vm'
response_body = JSON.parse(response.body)
hosts = if os_filter
... |
class Department < ActiveRecord::Base
belongs_to :store
has_many :aisles, foreign_key: :dept_id
has_many :items, through: :aisles, source: :items
end
|
require "readline"
require "reader"
require "printer"
$core_ns = {
:"=" => lambda {|a,b| a == b},
:throw => lambda {|a| raise MalException.new(a), "Mal Exception"},
:nil? => lambda {|a| a == nil},
:true? => lambda {|a| a == true},
:false? => lambda {|a| a == false},
:symbo... |
class RemoveColumnCategories < ActiveRecord::Migration[5.2]
def change
remove_column :categories, :path, :string
remove_column :categories, :category, :string
end
end
|
require 'wsdl_mapper/dom_parsing/xsd'
require 'wsdl_mapper/dom/documentation'
require 'wsdl_mapper/dom/bounds'
require 'wsdl_mapper/parsing/base'
module WsdlMapper
module DomParsing
class ParserBase < WsdlMapper::Parsing::Base
include Xsd
protected
def parse_base(node, type)
type.base_... |
class UserSerializer
def initialize(user_object)
@user = user_object
end
def to_serialized_json
@user.to_json(
:include => {
:user_countries => {
:include => {
:country => {:only => [:id, :name, :latitude, :longitude, :flag]},
:review => {:except => [:created_at, :user_country_id]}
},
... |
#!/usr/bin/env ruby
require "rubygems"
require ::File.dirname(__FILE__) + "/../lib/columbus"
require 'git-style-binary/command'
GitStyleBinary.primary do
@theme = :short
version "Columbus"
banner <<-EOS
Usage: #{$0} #{all_options_string} COMMAND [ARGS]
The #{$0} subcommands commands are:
\#{GitStyleBinar... |
class ApplicationController < ActionController::Base
include Trailblazer::Operation::Controller
NotAuthenticated = Class.new(StandardError)
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
before_action :stub_shib... |
# Author:: Derek Wang (mailto:derek.yuanzhi.wang@gmail.com)
# Copyright::
# License::
# Description::
# Usage::
class SystemSpecification < ActiveRecord::Base
belongs_to :user
has_many :ss_servers, :dependent => :destroy
has_many :ss_storages, :dependent => :destroy
belongs_to :service
has_many :ss_... |
require 'optparse'
module BuildLights
extend self
def cli(args)
urls = []
OptionParser.new do |opts|
opts.banner = "Usage: buildlights [options]"
opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
$verbose = true
end
opts.on("--hudson [URL]", "Hudson url") do |url|
... |
# Exercise4. Write a method last_modified(file) that takes a file name and displays something like this:
# file was last modified 125.873605469919 days ago.
# qUse the Time class.
|
require('pry-byebug')
require_relative('game')
require_relative('win_checker')
require_relative('rubbish_win_checker')
# create game
win_checker_1 = WinChecker.new()
rubbish = Rubbish_Win_Checker.new()
game = Game.new(rubbish)
# place piece
# game.turn(0,0)
# puts game.new_game
# # display board
# puts game.dis... |
class Intervention < Base
attr_accessor :efficacies
self.query = <<-EOL
PREFIX foaf: <http://xmlns.com/foaf/0.1>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX stories: <http://purl.org/ontology/stories/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xs... |
require 'test_helper'
require 'securerandom'
module M2R
class ConnectionFactoryTest < MiniTest::Unit::TestCase
def test_factory
sender_id = "sid"
request_addr = "req"
response_addr = "req"
pull = stub(:pull)
pub = stub(:pub)
context = stub(:context)
context.expe... |
#
# Cookbook Name: monit-ng
# Attributes: source
#
include_attribute 'monit-ng::default'
default['monit']['source'].tap do |source|
source['url'] = 'https://mmonit.com/monit/dist'
source['version'] = '5.14'
source['checksum'] =
'd0424c3ee8ed43d670ba039184a972ac9f3ad6f45b0806ec17c23820996256c6'
source['... |
module Dre
class ApplicationController < ActionController::Base
class Dre::NilPlatform < RuntimeError ; end
private
def detect_platform
if ios?
:ios
elsif android?
:android
end
end
def platform_header
request.headers['X-User-Platform'].tap do |header|
... |
class CreateConnections < ActiveRecord::Migration
def change
create_table :connections do |t|
t.integer :from_id
t.string :from_type
t.integer :to_id
t.string :to_type
t.integer :context_id
t.text :properties
t.timestamps
end
add_index :connections, [:to_typ... |
class LinkFormatValidator < ActiveModel::EachValidator
# This class is for validating that the given value is a valid URL,
# starting with http:// or https://
#
# It is used in a validates call like this:
# validates :home_page, link_format: true
#
def validate_each(object, attribute, value)
unless value =... |
require 'spec_helper'
describe DetectOrCreate do
before(:all) { class User < ActiveRecord::Base; end; }
it 'validates required arguments exist' do
expect { User.detect_or_create() }.
to raise_error(StandardError, "Missing Arguments: `by`")
end
it 'validates :by type' do
expect { User.detect_or_... |
# frozen_string_literal: true
class Actor < ApplicationRecord
include OperatorAccessor
has_paper_trail
has_many :appearances, dependent: :destroy
has_many :advertisements, dependent: :destroy
validates :name, presence: true
end
|
class CreateProducts < ActiveRecord::Migration
def change
create_table :products do |t|
t.references :product_category, index: true
t.string :name, null: false
t.string :path_id, null: false
t.string :factory, default: "", null: false
t.string :factory_url, default: "", null: false
... |
require 'mysql-helper.rb'
SQL = "SELECT COUNT(*),visited FROM user GROUP BY visited=true"
class ProgressChecker
def check
progress = {}
Mysql.open('jkan', 'blah', 'lj') do |db|
db.query(SQL) do |result|
counts = result.fetch_all(false)
counts.each do |count, visited|
... |
require 'spec_helper'
resource "Workspaces" do
let(:owner) { users(:owner) }
let(:user1) { users(:no_collaborators) }
let!(:workspace) { workspaces(:public) }
let!(:workspace_id) { workspace.to_param }
before do
log_in owner
end
post "/workspaces/:workspace_id/members" do
parameter :workspace_i... |
class MenuTag < ActiveRecord::Base
has_and_belongs_to_many :menu_items
validates :name, presence: true
end
|
class CreateCoughs < ActiveRecord::Migration
def change
create_table :coughs do |t|
t.string :type
t.integer :frequency
t.integer :age
t.timestamps null: false
end
end
end
|
class AddGameToAnswer < ActiveRecord::Migration
def change
add_reference :answers, :game
end
end
|
require "spec_helper"
class FakeDisplayOut
attr_reader :display
def puts(display)
@display = display
end
end
class FakeEntryIn
attr_writer :string
def gets
@string
end
end
module Mastermind
describe "Game" do
#objects--------------------------------------------------------------------... |
# Copyright (c) 2006, 2007 Ruffdogs Software, Inc.
# Authors: Adam Lebsack <adam@holonyx.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License.
#
# This program ... |
# frozen_string_literal: true
# rubocop:todo all
require 'lite_spec_helper'
describe Mongo::Error::BulkWriteError do
let(:result) do
{
'writeErrors' => [
{ 'code' => 1, 'errmsg' => 'message1' },
{ 'code' => 2, 'errmsg' => 'message2' },
]
}
end
let(:error) { described_class.n... |
class TrainersController < ApplicationController
before_action :authenticate_user, {only: [:new, :create, :edit, :update, :destroy]} #ログインしていないユーザに対するアクセス制限
before_action :ensure_correct_user, {only: [:edit, :update, :destroy]} #他のユーザ情報の編集・削除などに対するアクセス制限
# トレーナー一覧表示
def index
@trainers = Trainer.page(par... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.