text stringlengths 10 2.61M |
|---|
require './lib/wizards/room'
require './lib/wizards/player'
require './lib/wizards/wizard'
require 'spec_helper'
describe Rooms do
let(:wizard) { Wizard.new(subject.layout) }
let(:player) { Player.new }
describe "#initialize" do
it "starts with a wand in the 3 row and in room 4" do
subject.layout[2][3... |
require 'nokogiri'
PO_SCHEMA_FILE= File.join(File.dirname(__FILE__), "schemas", "CCOM-ML.xsd")
PO_XML_FILE="asset.xml"
STDOUT.write "instantiating the schema without chdir... "
begin
xsd = Nokogiri::XML::Schema(File.read(PO_SCHEMA_FILE))
rescue Exception => e
puts e.message
STDOUT.write "instantiating the schem... |
class OpenUspTukubai < Formula
desc "Tukubai command set for open source version"
homepage "https://uec.usp-lab.com/TUKUBAI/CGI/TUKUBAI.CGI?POMPA=DOWNLOAD"
url "https://uec.usp-lab.com/TUKUBAI/DOWNLOAD/open-usp-tukubai-20221028.tar.bz2"
version "20221028"
sha256 "abb42f9e60f8af809b346ef52dddd3ce4ac01b5ffededc... |
# encoding: UTF-8
# Copyright 2012 Twitter, Inc
# http://www.apache.org/licenses/LICENSE-2.0
module TwitterCldr
module Transforms
module Filters
class NullFilter < FilterRule
def matches?(cursor)
true
end
def forward?
true
end
def backward?
... |
require "spec"
require "../lib/poker_rules"
describe PokerRules do
it "should know that 1 pair is stronger than highest card" do
PokerRules.stronger_game(:one_pair, :highest_card).should == :one_pair
PokerRules.stronger_game(:highest_card, :one_pair).should == :one_pair
end
it "should know that 2 pairs ... |
class Source < ActiveRecord::Base
validates :funding_source, presence: true, uniqueness: true
has_many :research_efforts, dependent: :destroy
has_paper_trail
def human()
"Источник финансирования: #{self.funding_source}"
end
def Source.models_human_name()
"Источники финансирования"
end
end
|
class RestaurantService
def initialize(
client: Yelp::Client.new({consumer_key: ENV["YELP_CONSUMER_KEY"],
consumer_secret: ENV["YELP_CONSUMER_SECRET"],
token: ENV["YELP_TOKEN"],
token_secret: ENV["YELP_TOKEN_SECRET"]... |
# frozen_string_literal: true
module RuboCop
module Cop
module Rubygems
# This cop enforces that no outdated deprecations are present on RubyGems
# code base.
#
# @example
#
# # bad
# rubygems_deprecate :safdfa, :none
#
# # good
# # the `depreca... |
class RemoveTerTeamIdFromTeams < ActiveRecord::Migration
def change
remove_column :teams, :ter_team_id, :integer
end
end
|
class FilialPart < ApplicationRecord
belongs_to :part
belongs_to :filial
validates :price, numericality: { greater_than: 0.0 }
validates :price, presence: true
end
|
#!/bin/ruby
require 'json'
require 'stringio'
# Complete the 'findLowestPrice' function below.
#
# The function is expected to return an INTEGER.
# The function accepts following parameters:
# 1. 2D_STRING_ARRAY products
# 2. 2D_STRING_ARRAY discounts
#
def findLowestPrice(products, discounts)
cost = 0
dis_has... |
Gem::Specification.new do |s|
s.name = 'cisco_decrypt'
s.version = '0.0.1'
s.summary = 'Decrypt cisco passwords'
s.description = 'Decrypt cisco passwords to use the shared secret'
s.authors = 'elcuervo'
s.email = 'elcuervo@elcuervo.co'
s.homepage = 'http://github.com/elcuervo/c... |
class SparcRequestJob < ActiveJob::Base
queue_as :sparc_api_requests
class SparcApiError < StandardError
end
end
|
class UserSerializer < ActiveModel::Serializer
attributes :id, :username, :email, :contact_preference, :location, :created_at, :items
has_many :items
end
|
require "maruku"
module Jekyll
class ExpertPage < Page
def initialize(site, expert_file)
@site = site
@dir = "expert"
self.read_yaml(File.join(site.source, "_experts"), expert_file)
self.content = Maruku.new(self.content).to_html
# Include the current expert blog posts
sel... |
# RSpotify::authenticate("55c12b17da23491c82c85edd1c942d61", "190d444411b04417816ac4550e9115c4")
class ApplicationController < ActionController::API
def refresh
begin
#Rest client search. This asks spotify to give us an access_token and a refresh_token
#This where the param requirem... |
class Holiday
attr_reader :date,
:local_name,
:name,
:country_code,
:fixed,
:global,
:counties,
:launch_year,
:types
def initialize(attributes)
@date = attributes[:date]
@local_name = a... |
class Sight < ApplicationRecord
has_many :locations
has_many :countries, through: :locations
validates :name, uniqueness: true
validates :name, :creation_date, :height, presence: true
end
|
require_relative 'helper'
require_relative 'db'
require_relative '../lib/conceptql/query'
require_relative '../lib/conceptql/database'
describe ConceptQL::Operators do
dbConnection = ConceptQL::Database.new(DB)
it "should list codes and descriptions" do
query = dbConnection.query(["union",["cpt","99214"],[... |
class TrainInfo
attr_accessor :name, :route_data, :id, :direction, :time, :route
@@all = []
def initialize(route_data, name)
@name = name
self.id = route_data["nextStaId"]
self.direction = route_data["destNm"] #station destination(end of line)
self.time = route_data["arrT"]... |
require_relative 'assoc_options'
module Associatable
def belongs_to(name, options = {})
opts = BelongsToOptions.new(name, options)
assoc_options[name] = opts
define_method(name) do
foreign_key = opts.foreign_key
model_class = opts.model_class
primary_key = opts.primary_key
foreign... |
# frozen_string_literal: true
class User < ApplicationRecord
validates :email, :name, presence: true, uniqueness: true
has_many :posts, dependent: :destroy
enum role: [:local, :national, :admin]
after_initialize :set_default_role, if: :new_record?
private
def set_default_role
self.role ||= :local
... |
module CorePrint
class Orders < ListResource
def all
# Load all orders
orders = []
@cached = ApiResource.ensure_array(@account.request(:post, list_service, { :useronly => true }, { fromdate: 1.year.ago }))
data = @cached
return [] unless data
data.each do |o|
neworde... |
# Halvsies
# https://launchschool.com/exercises/d9b79537
# Write a method that takes an Array as an argument, and returns two Arrays (as a pair of nested Arrays) that contain the first half and second half of the original Array, respectively. If the original array contains an odd number of elements, the middle element... |
module Ivona::GetMd5
class << self
# Helper method to transform a string to MD5
def to_md5(a_string)
Digest::MD5.hexdigest(a_string)
end
# Formula for md5 param is: md5( md5( api_key ) + token )
def formula(token)
api_key = Ivona::Config.api_key
api_key_as_md5 = to_md5( api_key ... |
# frozen_string_literal: true
require "decidim/core/test/factories"
require "decidim/participatory_processes/test/factories"
require "decidim/meetings/test/factories"
FactoryBot.define do
factory :opinion_component, parent: :component do
name { Decidim::Components::Namer.new(participatory_space.organization.ava... |
#!/usr/bin/env ruby
require_relative '../../ruby_task_helper/files/task_helper.rb'
require 'json'
# Bolt task for sending an HTTP GET request
class HttpTask < TaskHelper
def add_module_lib_paths(install_dir)
Dir.glob(File.join([install_dir, '*'])).each do |mod|
$LOAD_PATH << File.join([mod, 'lib'])
end... |
class CreateOrder < ActiveRecord::Migration[5.2]
def change
create_table :orders do |t|
t.references :user
t.references :shopping_cart
t.string :state
t.decimal :total_product_amount, precision: 12, scale: 2
t.decimal :total_quantity, precision: 12, scale: 2
t.decimal :total_ta... |
# == Schema Information
#
# Table name: responses
#
# id :integer not null, primary key
# respondent_id :integer not null
# answer_choice_id :integer not null
# created_at :datetime
# updated_at :datetime
#
class Response < ActiveRecord::Base
validates :r... |
class Transaction < ActiveRecord::Base
belongs_to :category
validates :description, presence: true, length: { maximum: 50 }
validates :value, numericality: true
end
|
class FontLexend < Formula
head "https://github.com/google/fonts/raw/main/ofl/lexend/Lexend%5Bwght%5D.ttf", verified: "github.com/google/fonts/"
desc "Lexend"
desc "Expanded by font bureau with a range of 8 weights"
homepage "https://fonts.google.com/specimen/Lexend"
def install
(share/"fonts").install "L... |
Cuando('se atiende por {string} en el centro {string}') do |prestacion_nombre, centro_nombre|
request = {
'afiliado' => @id_afiliado,
'prestacion' => @prestaciones[prestacion_nombre],
'centro' => @centros[centro_nombre]
}
@response = Faraday.post(VISITAS_URL, request.to_json, 'Content-Type' => 'applic... |
describe Mellon::Store do
subject(:store) { Mellon::Store.new(project_name, keychain: keychain) }
let(:project_name) { "yaml store" }
let(:keychain) { Mellon::Keychain.new(keychain_path) }
describe "#initialize" do
it "requires a project name" do
expect { Mellon::Store.new }.to raise_error(ArgumentEr... |
# Cookbook Name:: rs_utils
# Recipe:: setup_monitoring
#
# Copyright (c) 2011 RightScale Inc
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitat... |
# 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 'yaml'
module Smsinabox
# Wrapper around our YAML configuration file, which lives in ~/.smsinabox by
# default
class Configuration
def initialize( config_file = nil )
@config_file = config_file
check_file!
load_config
end
def []( key )
@configuratio... |
class ApplicationController < ActionController::Base
protect_from_forgery
def after_sign_in_path_for(current_user)
if current_user.is_an_active_member?
dashboard_path
else
plans_path
end
end
private
def authenticate_admin
if !current_user.admin?
redirect_to root_url, not... |
require 'hyperclient'
require 'pp'
def print_resources(resources)
resources.each do |name, resource|
begin
puts %{Found #{name} at #{resource.url}}
rescue
puts %{Found #{name}}
end
end
end
def print_attributes(attributes)
puts "-----------------------------"
attributes.each do |attribu... |
class CreateCoffeeBeans < ActiveRecord::Migration
def self.up
create_table :coffee_beans do |t|
t.string :variety
t.string :comment
t.timestamps
end
end
def self.down
drop_table :coffee_beans
end
end
|
require "rspec"
require "base64"
require "pry"
def hex_to_bin(s)
s.scan(/../).map { |x| x.hex.chr }.join
end
def bin_to_hex(s)
s.each_byte.map { |b| b.to_s(16) }.join
end
def xor_hex(hex_1, hex_2)
result_bin = xor_bin(hex_to_bin(hex_1), hex_to_bin(hex_2))
bin_to_hex(result_bin)
end
def xor_bin(bin_1, bin_2)... |
require 'hmac-sha1'
require 'json'
require 'base64'
require 'cgi'
require './lib/config/security_config'
class Signature
def initialize(api_key, secret_code)
@api_key = api_key
@secret_code = secret_code
end
def generate(params)
params["apiKey"] = @api_key
params["timeStamp"] ||= Time.now.utc.strf... |
class AddLastposttimeToTopic < ActiveRecord::Migration[5.2]
def change
add_column :topics, :last_post_time, :datetime
end
end
|
# == Informacion de la tabla
#
# Nombre de la tabla: *dbm_calendario*
#
# idCalendario :integer(11) not null, primary key
# fecha :date not null
# tipo :string(50) default(""), not null
# titulo :string(255)
# resumen :text
# lugar :string(100)... |
module JackCompiler
module Transformer
class SimpleFormatter
def visit(node)
[
"#{node.class.name.split('::').last}: #{node.kind} | parent #{node.parent&.kind || '<NO PARENT>'}",
*node.descendants.flat_map { |child| child.accept(self) }.map { |format| " " + format }
]
... |
# frozen_string_literal: true
class Ticket < ApplicationRecord
belongs_to :event
has_many :event_attendees, dependent: :restrict_with_error
has_many :users, through: :event_attendee
has_many :attendee_characters, through: :event_attendee
enum pass_type: { event_pass: 0, day_pass: 1 }
def self.generate_t... |
class DropRewards < ActiveRecord::Migration
def change
drop_table :rewards
end
end
|
require 'rails_helper'
RSpec.describe Product, type: :model do
it { should validate_presence_of(:name) }
it { should validate_presence_of(:price) }
it { should validate_presence_of(:description) }
it { should validate_presence_of(:stock) }
it { should validate_length_of(:name).is_at_most(30) }
it { shoul... |
class AddSermonsAndSeries < ActiveRecord::Migration
def change
add_column :sermon_series, :summary, :text
add_column :sermons, :sermon_series_id, :integer
david = SermonAuthor.create(name: 'David Platt')
ss = SermonSeries.create({title: 'Different to Make a Difference', summary: "What's really differ... |
class ArticleMessage < ApplicationRecord
include AttachmentUploader[:attachment]
belongs_to :article
def attachment_name=(name)
@attachment_name = name
end
def attachment_name
@attachment_name
end
end
|
# encoding: utf-8
#
# © Copyright 2013 Hewlett-Packard Development Company, L.P.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
#... |
Sequel.migration do
change do
create_table(:messages) do
primary_key :id
String :author
String :dest
String :content
DateTime :created_at
DateTime :read_at
end
end
end
|
Pod::Spec.new do |s|
s.name = "WWCalendarTimeSelector"
s.version = "1.4.1"
s.summary = "Customizable iOS View Controller in Android style for picking date and time."
s.homepage = "https://github.com/weilsonwonder/WWCalendarTimeSelector"
s.license = { :type => "MIT", :file => "LICENS... |
class Api::V1::UserTokensController < Api::V1::BaseController
respond_to :json
def create
user = User.find_by(email: params[:user][:email])
return render json: { error: "user not found", status: 404 } unless user
# 校验用户密码
e_password = User.bcrypt(params[:user][:encrypted_password])
return ren... |
require "helper"
module Neovim
RSpec.describe Current do
let(:client) { Support.persistent_client }
let(:current) { client.current }
describe "#line" do
it "returns an empty string if the current line is empty" do
expect(current.line).to eq("")
end
it "returns the contents of ... |
class Cult
attr_reader :name, :location, :founding_year, :slogan
@@all = []
def initialize(name, location, founding_year)
@name = name
@location = location
@founding_year = founding_year
@slogan = nil
@@all << self
end
def slogan=(slogan)
@... |
FactoryBot.define do
factory :facilities_management_procurement_building, class: FacilitiesManagement::ProcurementBuilding do
name { Faker::Company.unique.name }
active { true }
procurement_building_services { build_list :facilities_management_procurement_building_service, 2 }
end
end
|
class LessonsController < ApplicationController
def index
end
def show
@lesson = Lesson.find(params[:id])
end
def new
@lesson = Lesson.new(params[:id])
authorize! :create, Lesson, message: "You need to be a moderator to create a new lesson."
end
def edit
@lesson = Lesson.find(params[:id])... |
require 'tilt'
require 'jbuilder'
module Tilt
class Jbuilder < ::Jbuilder
def initialize(scope, *args, &block)
@scope = scope
super(*args, &block)
end
def partial!(options, locals = {})
locals.merge! :json => self
view_path = @scope.instance_variable_get('@_jbuilder_view_path')
... |
require './lib/van'
class Van; include BikeContainer; end
describe Van do
let(:van) {Van.new(:capacity => 10) }
let(:bike) {Bike.new}
it 'should allow setting default capacity on initialising' do
expect(van.capacity).to eq (10)
end
it 'should only load broken bikes' do
broken_bike = Bike.new
normal_bike... |
require './lib/pixel'
require './lib/helpers/image_helper'
require './lib/helpers/fill_helper'
class Image
include ImageHelper
include FillHelper
attr_accessor :grid
def initialize(dimensions)
width = dimensions[0]
height = dimensions[1]
return puts('Invalid size') if invalid_dimensions(width, height)
... |
# frozen_string_literal: true
module Bolt
class PAL
class YamlPlan
class Step
class Eval < Step
def self.allowed_keys
super + Set['eval']
end
def self.required_keys
Set.new
end
def initialize(step_body)
super
... |
#-*- coding: utf-8 -*-
require "rubygems"
require 'bundler/setup'
require "rspec/core/rake_task"
TEST_HOME = File.expand_path(File.dirname(__FILE__))
desc "The *features tests"
RSpec::Core::RakeTask.new(:spec) do |t|
t.fail_on_error = false
t.rspec_opts = %w[--color]
t.verbose = false
t.pattern = "#{TEST_HO... |
require "rake/clean"
LIBSODIUM_VERSION = "0.2"
def sh_hidden(command)
STDERR.puts("*** Executing: #{command}")
output = `#{command}`
if !$?.success?
STDERR.puts "!!! Error executing: #{command}"
STDERR.puts output
exit 1
end
end
file "libsodium-#{LIBSODIUM_VERSION}.tar.gz" do
sh "curl -O http:... |
# frozen_string_literal: true
module Api
module V1
class ThermostatsController < BaseController
include ThermostatsHelper
def post_readings
if validate_params?
seq_no = reading_queue.push
render status: 200, json: {
'message' => 'Reading successfully saved',
... |
module Commonsense
module Core
class TagDocumentRelation < ActiveRecord::Base
belongs_to :tag, :counter_cache => true
belongs_to :document, :counter_cache => true
belongs_to :user
has_many :ratings, :as => :rateable, :dependent => :destroy
end
end
end
|
class CreateAdministrativeAreas < ActiveRecord::Migration
def change
create_table :dsc_administrative_areas do |t|
# These names map to the names in the api output in geo lookups
# code and long_name are currently the only columns we must have
t.string :code, null: false # e.g. ... |
Rails.application.routes.draw do
root to: 'games#index'
resources :games, only: [:create, :show, :index] do
post :play, on: :member
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 'spec_helper'
describe Scheherazade do
context 'when creating a simple post' do
around { |example| story.tell { example.run } }
let(:params) { {} }
let(:post) { Section::Post.imagine(params) }
subject { post }
it { should be_a Section::Post }
its(:content) { should_not be_blank }
... |
class TeamStats
attr_accessor :team, :matches, :not_played, :maps, :wins, :losses, :points, :frags_diff, :frags_for, :frags_against, :assists, :priority
# initializes TeamStats object for given Team object
#
# +options+ hash should be passed to customize statistics:
# [competition] Competition object will... |
class AddDatasToUsers < ActiveRecord::Migration[5.2]
def change
add_column :users, :supervisor, :boolean
add_column :users, :last_name, :string
add_column :users, :first_name, :string
add_column :users, :club, :string
add_column :users, :licence, :string
add_column :users, :gender, :string... |
FactoryBot.define do
factory :avatar do
association :user
filename { 'white.jpeg' }
filetype { 'image/jpeg' }
image { File.read("#{Rails.root}/spec/factories/images/white.jpeg") }
filesize { image.size }
trait :other do
filename { 'white2.png' }
filetype { 'image/png' }
imag... |
# frozen_string_literal: true
task :console do
require 'irb'
require 'irb/completion'
require Rails.root.join('config', 'application.rb')
Rails.application.require_environment!
def app
API::Base
end
def json
JSON.parse(last_response.body, symbolize_names: true)
end
include Rack::Test::Met... |
Spree::Core::Engine.routes.draw do
# Add your extension routes here
namespace :admin do
resources :delivery_cities, only: [:index, :destroy, :edit, :update, :new, :create] do
end
end
end
|
require 'spec_helper'
describe 'Create external event of talk', js: true do
let!(:user) { create(:user, :paul) }
let!(:talk) { create(:talk, users: [user], owner: user) }
before do
login_as user, talk_path(talk)
end
context 'when valid data' do
before do
click_link 'Criar evento externo'
... |
# --- Day 21: RPG Simulator 20XX ---
# Little Henry Case got a new video game for Christmas. It's an RPG, and he's stuck on a boss. He needs to know what equipment to buy at the shop. He hands you the controller.
# In this game, the player (you) and the enemy (the boss) take turns attacking. The player always goes fi... |
# encoding: utf-8
#
# © Copyright 2013 Hewlett-Packard Development Company, L.P.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
#... |
class DeleteMisurationSubscriptions < ActiveRecord::Migration[6.0]
def change
drop_table :misuration_subscriptions
end
end
|
class RenameFormatColumn < ActiveRecord::Migration
def up
rename_column :questions, :format, :required_format
end
def down
end
end
|
class User < ActiveRecord::Base
validates :name, presence: true
validates :name, uniqueness: { case_sensitive: false, message: "用户名已存在" }
validates :password, confirmation: true, presence: true
validates :password_confirmation, presence: true
end
|
class UsersController < ApplicationController
before_action :set_user, only: %i(update)
def index
@users = User.includes(:person).order('people.name ASC').page(params[:page])
end
def edit; end
def update
@user.update(user_params) ? (redirect_to users_path, notice: t('.notice')) : (render :edit)
e... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
#
VAGRANTFILE_API_VERSION = "2"
ENV['VAGRANT_DEFAULT_PROVIDER'] ||= 'docker'
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
DOCKER_IMAGE_REPO = "mtbvang"
# UPDATE these project specific details.
PROJECT_NAME = "<projectName>"
FORWARDED_PORT_OFFSET = <portOffs... |
module RecordController
def update_from_json(json, opts = {}, apply_nested_records = true)
if json['dates_of_existence'].all?{|d| d['end']}
# trying to terminate the agency
# so fail if it has any open control relationships
open_control = db[:series_system_rlshp]
.filter(:jsonmodel_typ... |
require 'spec_helper'
describe Users::CertificatesController do
let(:user) { create(:user) }
describe "for anonymous users" do
it "GET :show redirects" do
get :show
subject.should redirect_to(user_session_path)
end
it "PUT :update redirects" do
put :update
subject.should re... |
require_relative '../lib/pi_calculator'
describe ProcessForker::PiCalculator do
subject { calculate }
let(:instance) { described_class.new(output_stream) }
let(:output_stream) { double }
let(:processes_number) { 5 }
let(:calculate) { instance.call(processes_number) }
before { allow(output_stream).to rec... |
require 'rails_helper'
RSpec.describe Order, type: :model do
before :each do
@order = build :order
end
subject { @order }
it { should respond_to :total }
it { should respond_to :user_id }
it { should be_valid }
it { should validate_presence_of :user_id }
it { should belong_to :user }
it { sh... |
#
# Specification of Virtual Machines managed by Vagrant.
# This script supports VirtualBox and HyperV providers.
# Machines should be specified in Vagranthosts.yaml file.
# Vagranthosts.yaml files has got documentation embedded in comments.
# Behaviour of this script is also documented in comments below.
#
#
# Load m... |
# coding: utf-8
module Serps
# Search Base Class
class Search
class NotFound < StandardError; end
class ServerError < StandardError; end
class AccessBlock < StandardError; end
AGENT = {
pc: 'Mozilla/5.0',
fp: 'DoCoMo/2.0 P903i(c100;TB;W24H12',
sp: 'Mozilla/5.0 (iPhone; CPU iPhone... |
# frozen_string_literal: true
module Main
module Views
class ApplicationLayout < View
def template
doctype
html do
head do
link(rel: "stylesheet", href: "https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css")
end
body do
div(class:... |
# frozen_string_literal: true
module Dotfiles
module Installers
class Git < BaseInstaller
def name
'git configuration'
end
private
def perform_installation
file = destination_for('.gitconfig')
symlink(dotfile('git/gitconfig'), file)
email = ask('What is ... |
require 'test_helper'
class MenuSectionInstancesControllerTest < ActionController::TestCase
setup do
@menu_section_instance = menu_section_instances(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:menu_section_instances)
end
test "should get ... |
require 'test_helper'
class StoryTest < ActiveSupport::TestCase
should belong_to :site
should validate_presence_of :url
should validate_presence_of :title
should validate_presence_of :content
should validate_presence_of :posted_at
should validate_presence_of :site
should validate_presence_of :autho... |
title 'hawaii-alaska.whaledisentanglement.org tests'
control 'hawaii-alaska-whaledisentanglement-org' do
impact 1.0
title 'Hawaii Alaska Whale Disentanglement site is verified'
desc 'test that the hawaii-alaska.whaledisentanglement.org is working'
httpsResponse = inspec.http("https://hawaii-alaska.whaledisent... |
require 'spec_helper'
describe 'chef_ruby::default' do
let(:chef_run) { runner.converge described_recipe }
before do
stub_command('ruby -v | grep 2.0.0p247').and_return(false)
stub_command('gem -v | grep 2.0.6').and_return(false)
end
%w( wget zlib1g-dev libssl-dev libffi-dev libxml2-dev libncurses-de... |
# Allows filtering of concrete_factories provided by
# the AbstractFactory module. It expects the class to
# have a concrete_factories method defined.
# Usage:
#
# class Foo
# include AbstractFactory.new(FactoryWrapperModule)
# include FactorySearch
#
# def foo(key)
# find_by_key(key)
# end
# end
module F... |
class ApplicantJobPreference < ActiveRecord::Base
belongs_to :applicant
belongs_to :location
attr_accessible :applicant_id, :location_id, :prefer_expected_salary, :prefer_job_time, :prefer_start_available
validate :job_time_validator
validates :prefer_start_available,:presence=>true
validate :prefer_star... |
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Brigitte::Game, type: :model do
let(:player_names) { %w[player1 player2 player3] }
describe '#initialize' do
it 'initializes all attributes' do
game = described_class.new
expect(game.active_players).to eq []
expect(game.car... |
class WeddingAlbumsController < ApplicationController
before_action :set_wedding_album, only: [:show, :edit, :update, :destroy]
before_action :authenticate_user!, except: [:index, :show]
skip_before_action :verify_authenticity_token
load_and_authorize_resource
# GET /wedding_albums
# GET /wedding_albums.js... |
class Helper
def self.current_user(session)
@user = User.find_by_id(session[:user_id])
end
def self.logged_in?(session)
!!User.find_by_id(session[:user_id])
end
def self.show_logout(session)
if !!User.find_by_id(session[:user_id])
" <form action= '/logout' method='get'>
<inp... |
class ApplicationController < ActionController::Base
# reset captcha code after each request for security
after_filter :reset_last_captcha_code!
protect_from_forgery
before_filter :check_cookie
def check_login
unless logined?
redirect_to root_path
end
end
def logined?
!!session[:user_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.