text stringlengths 10 2.61M |
|---|
require 'rails_helper'
RSpec.describe Admin::ReportTypesController, type: :controller do
before do
@admin = FactoryGirl.create(:admin)
@report_type = FactoryGirl.create(:report_type)
end
describe "GET #index" do
it "returns a success response" do
sign_in @admin
get :index
expect(r... |
def my_select(collection)
# if array is length > 0
## This block should not run!"
# iterate through each item
# is it nil?
# checking for truthiness
#return original array
i = 0
newArray = []
while i < collection.length
varName = yield(collection[i])
if varName == TRUE
newArray << co... |
require 'rails_helper'
RSpec.describe "author show page", type: :feature do
before(:each) do
@author_1 = Author.create!(name: "Author 1")
@author_2 = Author.create!(name: "Author 2")
@author_3 = Author.create!(name: "Author 3")
@book_1 = @author_1.books.create!(title: "Book 1", publication_year: 199... |
require "minitest_helper"
describe LevelEditor::ImageInterroger do
describe "6x3 image with 1 horizontal bar" do
# 012345
# 0 xxxoxx x white
# 1 ooo-xx o black
# 2 xxxxxo - red
before do
@image_interroger = LevelEditor::ImageInterroger.new("images/test_case1.bmp")
end
... |
json.array!(@channel.articles.order(pubdate: :desc)) do |article|
json.set! :site, article.channel.site
json.set! :channel, article.channel
json.extract! article, :id, :channel_id, :title, :link, :pubdate, :guid, :description, :content
end
|
# encoding: utf-8
control "V-52187" do
title "The DBMS must notify appropriate individuals when accounts are created."
desc "Once an attacker establishes initial access to a system, they often attempt to create a persistent method of re-establishing access. One way to accomplish this is for the attacker to simply cr... |
require 'rails_helper'
RSpec.describe Message, type: :model do
it "test creation" do
@user = create(:user)
@message = build(:message)
expect(@message).to be_valid
end
it "test owner" do
@user = create(:user)
@message = build(:message, user_id: nil)
expect(@message).to_not be_valid
end
... |
module EmbeddableContent
class TreeBasedNodeProcessor < EmbeddableContent::RecordNodeProcessor
EMBBEDER_TAG_TREE_ID_ATTRIBUTE = 'data-tree-ref-id'.freeze
private
def node_should_be_replaced?
super && tag_references_current_tree?
end
def tag_references_current_tree?
embedded_tag_tree... |
class Letter
#Letter objects that contain their own NAME, and a list of POSSIBLE interpretations
#It is assumed that by the rules of the cryptogram that they cannot end up being themself
attr_accessor :name, :possibles
def initialize(itself="r")
#Sets the possible list, and the self.name
#lowercase let... |
require 'spec_helper'
require 'facter/util/public_ipaddress'
describe Facter::Util::PublicIpaddress do
let (:openuri) do
OpenURI
end
describe Facter::Util::PublicIpaddress.cache do
it 'should return cache file path' do
Facter::Util::PublicIpaddress.cache.should == '/var/tmp/public_ip.fact.cache'
... |
require 'spec_helper'
describe Analyst::Entities::MethodCall do
describe "#constants" do
let(:code) { "Universe.spawn(Star, into: Galaxy.named('Milky Way'))" }
let(:method_call) { Analyst.for_source(code).method_calls.first }
it "lists constant targets and arguments" do
found = method_call.consta... |
require 'rails_helper'
RSpec.describe SocialMediaBlitzing, type: :model do
describe 'when mobilization is saved' do
before :each do
@social_media_blitzing = SocialMediaBlitzing.new
end
it 'should not take string in numeric field' do
@social_media_blitzing.number_of_posts = 'string'
... |
class HenryV < ShakesChar
def initialize
@name = "Henry V, King of England, Lord of Ireland"
@play = "The Life of King Henry the V, and my role is based off the actual English King Henry V"
@gender = "male"
@age = 29
end
def quote
super +
"Once more unto the breach, dear ... |
# -*- encoding : utf-8 -*-
module Nyaa
class Downloader
attr_accessor :target, :destination, :retries
attr_accessor :response, :filename
def initialize(url, path, retries = 3)
self.target = url
self.destination = Nyaa::Utils.safe_path(path)
self.retries = retries
self.res... |
class Fixnum
define_method(:prime_numbers) do
number_range = (2..self)
prime_array = []
number_range.each() do |number|
prime_array.push(number)
end
prime = 2
until prime == self
prime_array.delete_if{|number| number%prime==0 && number!= prime}
prime += 1
end
prime_ar... |
require 'spec_helper_acceptance'
describe 'removing yarn' do
describe 'running puppet code' do
pp = <<-EOS
class { 'nodejs':
repo_url_suffix => '6.x',
}
if $::osfamily == 'Debian' and $::operatingsystemrelease == '7.3' {
class { 'yarn':
manage_repo => false,
... |
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe Room do
describe "(instance methods)" do
before(:each) do
@room = Factory(:room)
end
it "should return a permalink when converted to a param" do
@room.to_param.should == @room.permalink
end
end
de... |
#!/usr/bin/env ruby
# frozen_string_literal: true
#
# Copyright (C) 2016 Scarlett Clark <sgclark@kde.org>
# Copyright (C) 2015-2016 Harald Sitter <sitter@kde.org>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the... |
class TelefonesController < ApplicationController
before_action :set_telefone, only: [:show, :edit, :update, :destroy]
# GET /telefones
# GET /telefones.json
def index
@telefones = Telefone.all
listarContatos
end
# GET /telefones/1
# GET /telefones/1.json
def show
listarContatos
end
#... |
require 'rails_helper'
RSpec.describe Place, :type => :model do
describe "validations" do
it "validates presence of name" do
place = FactoryGirl.build(:place, name: nil)
expect(place.valid?).to be false
expect(place.errors[:name].present?).to be true
end
it "validates uniqueness of ... |
require 'spec_helper'
describe User do
it "can't login with new user" do
User.login('newuser', 'fakepassword').should == -1
end
it "can't create user with no name" do
User.add('', 'fakepassword').should == -3
end
it "can't create user with too long name" do
User.add('long'*1... |
class HttpUrlValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
return true if value.blank?
url = Addressable::URI.parse value
scheme = url.scheme rescue nil
probable_mistake = url.host.exclude?('.') rescue true
if %w[http https].exclude?(scheme) || probable_mistak... |
class CreateAuctionData < ActiveRecord::Migration
def change
create_table :auction_data do |t|
#edited due to bug in rails 4.2.0
t.integer :auc, limit: 8
t.integer :item_id, limit: 8
t.string :owner
t.string :ownerRealm
t.integer :bid, limit: 8
t.integer :buyo... |
require_relative 'prices'
require "pry"
class Pizza
include Prices
def initialize(size, type, crust)
@size = size
@type = type
@crust = crust
end
def full_order
{
size: @size,
type: @type,
crust: @crust
}
end
def calculate_price
total_price = 0.0
pizza_pric... |
require 'securerandom'
class Thing
attr_reader :id, :name, :created_at
def initialize(id: SecureRandom.uuid, name:, created_at: nil)
@id = id
@name = name
@created_at = created_at
end
end
|
require 'rails_helper'
describe Repo do
it 'exists' do
attrs = {
name: 'Test Repo',
html_url: 'https://www.github.com/users/tylorschafer'
}
repo = Repo.new(attrs)
expect(repo).to be_a Repo
expect(repo.name).to eq(attrs[:name])
expect(repo.html_url).to eq(attrs[:html_url])
end
... |
# frozen_string_literal: true
require 'brcobranca/calculo'
require 'brcobranca/limpeza'
require 'brcobranca/formatacao'
require 'brcobranca/formatacao_string'
require 'brcobranca/calculo_data'
require 'brcobranca/currency'
require 'brcobranca/validations'
require 'brcobranca/util/date'
require 'fast_blank'
module Brc... |
class HomeController < ApplicationController
def index
@initiatives = Initiative.latest(3)
end
end
|
module Sears
class Address < Sears::Base
attr_accessor :type, :line_1, :line_2, :city, :state, :zip_code, :segment_code, :country_code, :preferred
def self.from_multi_lookup_response_string(string)
raise InvalidResponseFormat unless string.size == 121
return self.new(
:type ... |
class UpdateHistoryCheckInOutViewsToVersion6 < ActiveRecord::Migration
def change
update_view :history_check_in_out_views,
version: 6,
revert_to_version: 5,
materialized: true
end
end
|
class Desk < ApplicationRecord
belongs_to :floor
belongs_to :contestant, class_name: 'Person', required: false
belongs_to :machine, required: false
has_many :assignment_histories, class_name: 'DeskAssignmentHistory'
around_save :create_assignment_history
def create_assignment_history
create_history =... |
FactoryGirl.define do
factory :position_request do
position
status PositionRequest::STATUS_PENDING
applicant "email" => "office@kolosek.com"
end
end |
Rails.application.routes.draw do
resources 'pacientes'
resources 'anamneses'
resources 'avaliacoes'
resources 'tratamentos'
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
root :to => 'pacientes#index'
get '/sign_in', :to => 'sessions#sign_in', :as ... |
require_relative 'curses_window'
module Messenger
class CursesSelect
def self.select(options)
result = nil
begin
result = new(options).select
rescue Interrupt
ensure
Curses.close_screen
end
result
end
def initialize(options)
@filtered_options = ... |
Rails.application.routes.draw do
devise_for :users, :controllers => { :omniauth_callbacks => "omniauth_callbacks" }
resources :donations
resources :pledges
resources :carts
resources :notes
get 'charity/index'
#resources :user, only: [:show, :edit, :update]
get 'user/:id/profile' => 'user#profile', as:... |
# frozen_string_literal: true
require 'healthcare_phony'
require 'logger'
require 'socket'
def lambda_handler(event:, context:)
return_message = ''
logger = Logger.new($stdout)
logger.info('## ENVIRONMENT VARIABLES')
logger.info(ENV.to_a)
logger.info('## EVENT')
logger.info(event)
event.to_a
number... |
require_relative 'binaryio'
module Asciidoctor
module Diagram
module SVG
def self.get_image_size(data)
if m = START_TAG_REGEX.match(data)
start_tag = m[0]
if (w = WIDTH_REGEX.match(start_tag)) && (h = HEIGHT_REGEX.match(start_tag))
width = w[:value].to_i * to_px_fact... |
class OrderMailer < ApplicationMailer
default to: 'jan.hlavsa@seznam.cz'
def order_mail
@order = Order.new(params)
mail(from: 'primluvysporilov@gmail.com', subject: 'Stránky Spořilov - prosba o přímluvu')
end
end
|
# encoding: utf-8
module StatisticsHelper
##
# returns the occurences of the card in the group
# * *Args* :
# -+card+->: card instance
# -+group+->: group instance
# * *Returns* :
# - number of ocurrences of card in group
#
def getOccurrences(card, group, cardsort, reviewer)
count = 0... |
require 'rails_helper'
feature 'Log in with Auth0' do
before do
Capybara.register_driver :chrome do |app|
Capybara::Selenium::Driver.new(app, browser: :chrome)
end
Capybara.javascript_driver = :chrome
end
given(:user) { create(:user) }
context 'With valid credentials' do
scenario 'Shou... |
puts "Hi, there!"
while true
answer = gets.chomp
if answer == "I'm a dummy"
puts "I'm not stupid"
break
end
puts answer
end
|
class Hand_Type
include Comparable
attr_reader :ranking, :name
def initialize(cards, ranking, name)
@cards = cards
@ranking = ranking
@name = name
end
def <=> (other)
if ranking == other.ranking
compare_hands_of_same_rank(other)
else
... |
class Squad < ApplicationRecord
has_many :squad_members
has_many :members, through: :squad_members
end
|
class Node
def initialize(value, next_node=nil)
@value = value
@next = next_node
end
def value
@value
end
def get_next
@next
end
def set_next(node)
@next = node
end
def set_value(new_value)
@value = new_value
end
end
def create_list(arr = [])
list = Node.new(0)
dummy = list
arr.each do ... |
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'permCheck/version'
Gem::Specification.new do |spec|
spec.name = PermCheck::PACKAGE
spec.version = PermCheck::VERSION
spec.authors = ["Gord Brown"]
spec.email ... |
class Main
helpers do
def default_account_subdomain
@account.username if @account && @account.respond_to?(:username)
end
def account_url(account_subdomain = default_account_subdomain, use_ssl = request.secure?)
(use_ssl ? "https://" : "http://") + account_host(account_subdomain)
end
... |
# Run me with `rails runner db/data/20211124_create_implementing_organisation_participations.rb`
ImplementingOrganisation.where.not(name: "0").each do |org|
next unless org.activity
unique_org = Organisation.find_matching(org.name)
if unique_org
puts "#{org.name} maps to Unique IO named #{unique_org.name}"
... |
# frozen_string_literal: true
require 'serialization'
require_relative 'pane_definition'
require_relative 'panes/layout'
module Build
class Panes
include Serialization
readable(
:definitions,
default: [],
loads: lambda { |defs| defs.map { |pane_def| PaneDefinition.new pane_def } }
)... |
class Talk < ActiveRecord::Base
belongs_to :speaker,
class_name: 'User'
has_and_belongs_to_many :topics
has_many :materials
accepts_nested_attributes_for :materials,
allow_destroy: true,
reject_if: :all_blank
validates :date,
... |
class LayoutGrid < Draco::Component
attribute :orientation, default: :vertical
attribute :space, default: :evenly
attribute :align, default: :center
attribute :padding, default: 0
end
|
class FavoritesController < ApplicationController
before_filter :authenticate_user!, :except => :index
before_filter :setup
def index
@favorite_chefs = @profile.favorite_chefs
end
def create
current_profile.add_favorite_chef(@profile)
redirect_to @profile
end
def destroy
current_profile... |
module Disposable
def dispose
test_disposed
@disposed = true
end
def disposed?
return @disposed == true
end
def test_disposed
if disposed?
raise "This class has been disposed, making this method inaccessible.\n\n" + caller.join("\n")
end
end
end
|
class TicketsController < ApplicationController
before_action :find_ticket, only: %i[show edit update destroy take_in_work resolved closed]
before_action :owned_ticket, only: %i[edit update destroy]
before_action :ticket, only: :new
def index
(@filterrific = initialize_filterrific(
Ticket,
para... |
class AddUpdatedAtIndex < ActiveRecord::Migration
def change
add_index :handles, :updated_at
end
end
|
class Api::V1::RandomCustomersController < Api::ApiController
respond_to :json
def show
respond_with Customer.random
end
end
|
# -*- encoding : utf-8 -*-
require 'helper'
class StringToBoolTest < Test::Unit::TestCase
context "String to_bool" do
should "return true" do
assert "true".to_bool, "true"
assert "1".to_bool, "1"
assert "t".to_bool, "t"
assert "y".to_bool, "y"
assert "yes".to_bool, "yes"
end
... |
unless Vagrant.has_plugin?("vagrant-dsc")
raise 'vagrant-dsc plugin is not installed! Please install with: vagrant plugin install vagrant-dsc'
end
$shell_script = <<SCRIPT
# config desired state
. C:\\vagrant\\powershell\\manifests\\LCMConfig.ps1
LCMConfig
Set-DscLocalConfigurationManager -Path ".\\LCMConfig... |
class ExpenseType < ApplicationRecord
# Associations
has_many :finances
has_many :banks
end
|
def source
<<eos
protocol MyAwesomeProtocol {
var foo:Int{get}
}
eos
end
def expected_tokens
[
T_PROTOCOL,
T_WHITESPACES(' '),
T_IDENTIFIER('MyAwesomeProtocol'),
T_WHITESPACES(' '),
T_OPEN_CURLY_BRACKET,
T_WHITESPACES("\n "),
T_VAR,
T_WHITESPACES(' '),
T_IDENTIFIER('foo'),
... |
class Assignment < ApplicationRecord
belongs_to :question
belongs_to :assigner, :class_name => "User"
belongs_to :assignee, :class_name => "User"
after_create :create_notifications
private
# assign하면 assign 받은 사람에게 보내지는 노티 생성.
def create_notifications
Notification.create(recipient... |
require_relative '../../lib/modules/method_missing'
####
#
# AgentWith
#
# Makes a Agent hold a unique identifier.
#
# Import records for Agents do not have a human_ref that identifies
# them. The identifier, instead, comes from the Property's human_ref.
#
# Identifying a Agent by the human_ref is only needed during th... |
assert("utc_offset") do
time = Time.local(2000, 1, 1, 11, 11, 11, 111111)
utc_offset = time.utc_offset
assert_kind_of(Integer, utc_offset)
# Calculate local time offset (e.g. -06:00 if local time is CST) for subsequent tests
utc_offset_minutes, _ = utc_offset.divmod(60)
utc_offset_hours, utc_offset_minut... |
class ApplicationController < ActionController::Base
before_filter :authorize, :checkAccess
protect_from_forgery
INACTIVITY_PERIOD = 60
CLOSED_ACTION_LIMIT = 3
layout "WardAreaBook"
def current_user_session
return @current_user_session if defined?(@current_user_session)
@current_user_session = Us... |
module NavigationHelpers
def path_to(page_name)
case page_name
when /a page/
'/'
when /a protected page/
'/dashboard'
when /the dashboard/
'/dashboard'
when /the signup page/
'/signup'
when /the login page/
'/login'
when /the logout page/
'... |
require "json"
require "selenium-webdriver"
require "test/unit"
class LogIn < Test::Unit::TestCase
def setup
@driver = Selenium::WebDriver.for :chrome
@base_url = "https://staging.shore.com/merchant/sign_in"
@accept_next_alert = true
@driver.manage.timeouts.implicit_wait = 30
@verification_error... |
class BankOperation
attr_reader :date, :credit, :debit, :new_balance
def initialize(date, credit, debit, new_balance)
@date = date
@credit = credit
@debit = debit
@new_balance = new_balance
end
end
|
module ReportsKit
module Reports
module FilterTypes
class Boolean < Base
DEFAULT_CRITERIA = {
value: nil
}
def apply_conditions(records)
case conditions
when ::String
records.where("(#{conditions}) #{sql_operator} true")
when ::Has... |
class AddIsDeletedToUserGroups < ActiveRecord::Migration[5.1]
def change
unless column_exists? :user_groups, :is_deleted
add_column :user_groups, :is_deleted, :boolean, default: false
end
end
end
|
require 'test_helper'
class PhotoTest < ActiveSupport::TestCase
test "should create a new photo" do
photo = Photo.new(:image_description =>"S",
:image_name =>"S_1.png", :image_type =>1)
assert photo.save
end
test "should not create a new photo" do
photo = Photo.new(:image_description =>"S",
... |
class ProductSearchTask < ApplicationRecord
has_many :amazon_products
scope :active, -> { where(running: true) }
def soft_page_limit
10
end
def self.run_random_active_job
active_jobs = self.active
if active_jobs.any?
active_jobs.sample.tick!
else
puts "Found no active jobs... |
class Admin::ForumPostsController < ApplicationController
before_filter :login_required
before_filter :find_forum
# GET /forums/1/forum_posts
# GET /forums/1/forum_posts.xml
def index
@forum_posts = @forum.forum_posts.find(:all)
respond_to do |format|
format.html # index.rhtml
format.x... |
#Clean Final
# require_relative 'environment'
require 'active_record'
class CreateTables < ActiveRecord::Migration[5.0]
def up
create_table :movies do |t|
t.string :title
end
create_table :ratings do |t|
t.belongs_to :movie
t.integer :movie_id
t.integer :user_id
t.integer :... |
require 'dragonfly'
require 'rails'
module Dragonfly
class Railtie < ::Rails::Railtie
initializer "dragonfly.railtie.initializer" do |app|
app.middleware.insert_before 'ActionDispatch::Cookies', Dragonfly::CookieMonster
end
initializer "dragonfly.railtie.load_app_instance_data" do |app|
Rai... |
class DropAuthorsBooksTable < ActiveRecord::Migration[5.1]
def change
drop_table :authors_books
end
end
|
class GigsController < ApplicationController
# GET /gigs
# GET /gigs.json
def index
@gigs = Gig.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @gigs }
end
end
# GET /gigs/1
# GET /gigs/1.json
def show
@gig = Gig.find(params[:id])
respo... |
module ActsAsOpengraphHelper
NON_ESCAPED_ATTRIBUTES = %w(og:image og:url)
# Generates the opengraph meta tags for your views
#
# @param [Object, #opengraph_data] obj An instance of your ActiveRecord model that responds to opengraph_data
# @return [String] A set of meta tags describing your graph object based ... |
require "sinatra"
class Hivemind < Sinatra::Base
get "/activity" do
@latest = Event.last(25)
erb :"events/index"
end
end
class Event < Sequel::Model
def nice
case kind.to_sym
when :uploaded_epub
user_link = %(<a class="underline hover:text-indigo-500" href="/@#{user.username}">@#{user.user... |
require 'rails_helper'
RSpec.describe ItemPurchase, type: :model do
before do
@item_purchase = FactoryBot.build(:item_purchase)
end
describe '商品購入機能' do
context '購入がうまくいくとき' do
it 'すべての値が正しく入力されていれば購入できる' do
expect(@item_purchase).to be_valid
end
it '建物名が空でも購入できる' do
@i... |
class SetDefaultRatingToItems < ActiveRecord::Migration[5.0]
def change
change_column :items, :rating, :float, :default => 3.5
end
end
|
require 'rails_helper'
RSpec.describe CabinetController, type: :controller do
describe "GET #dashboard" do
login_user
it "returns http success" do
get :dashboard
expect(response).to have_http_status(:success)
end
it "renders the dashboard template" do
get :dashboard
expect(res... |
require 'rails_helper'
RSpec.describe FavouriteLanguageController, :type => :controller do
describe 'GET favourite-language/:username' do
let(:service_factory) { Github::FavouriteLanguageService }
let(:service) { instance_double(service_factory) }
let(:service_result) { double('Result') }
before {
... |
require 'rails_helper'
RSpec.describe ChoicesController, type: :request do
let(:user) { FactoryBot.create(:user, :with_motherboard) }
let(:motherboard) { user.motherboards.first }
context 'signed in' do
before(:each) { sign_in user }
describe '#create' do
subject { post "/board/#{motherboard.... |
class IntToDec < ActiveRecord::Migration[5.0]
def change
reversible do |x|
x.up do
change_column :parts, :quantity, :decimal
end
x.down do
change_column :parts, :quantity, :integer
end
end
end
end
|
class AddCounterCacheFieldsToUsers < ActiveRecord::Migration[6.0]
def change
add_column :users, :collected_coins_count, :integer, default: 0
add_column :users, :deaths_count, :integer, default: 0
add_column :users, :killed_monsters_count, :integer, default: 0
end
end
|
Pod::Spec.new do |s|
s.name = "XWTagView"
s.version = "1.0.2"
s.summary = "XWTagView"
s.description = "awesome! XWTagView"
s.homepage = "https://github.com/jprothwell/XWTagView"
s.license = "MIT"
s.author = "Leon"
s.source = { :git => "https://github.com/jprothwell/XWTagView.git"... |
###################################
#
# vrrichedit.rb
# Programmed by nyasu <nyasu@osk.3web.ne.jp>
# Copyright 2000-2005 Nishikawa,Yasuhiro
#
# More information at http://vruby.sourceforge.net/index.html
#
###################################
VR_DIR="vr/" unless defined?(::VR_DIR)
require VR_DIR+'vrcontrol'... |
class RecipesController < ApplicationController
include PublicIndex
#load_and_authorize_resource
before_action :find_recipe, only: [:show, :edit, :destroy, :update]
before_action :build_comment, only: :show
skip_before_action :authenticate_user!, only: [:index, :show]
def index
if params[:tag]
... |
class GeneralSettingsController < ApplicationController
def new
@general_setting = current_user.general_setting
end
end
|
module Payment
class BankSlip < Base
include IuguBase
def self.taxes
2.50
end
private
def payment_method
'bank_slip'
end
def taxes
self.class.taxes
end
def due_date
{ due_date: Date.today.in_time_zone.strftime('%d/%m/%Y') }
end
def charge_param... |
require 'rails_helper'
describe Post do
it { is_expected.to have_many(:comments).dependent(:destroy) }
it {is_expected.to belong_to(:user) }
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 rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel... |
class CoordinatorSemestersController < WebApplicationController
before_action :set_coordinator_semester, only: [:show, :edit, :update, :destroy]
# GET /coordinator_semesters
# GET /coordinator_semesters.json
def index
@semester = ( params[:semester] == nil ? Semester.where( current: true ).first : Semester... |
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe Api::V1::StagingController do
login_admin
describe '#get_countries' do
it 'returns a successful 200 response' do
get :get_countries
expect(response).to be_successful
end
it 'returns a set of country data that includes al... |
require 'rails_helper'
RSpec.describe PlayerSerializer, :type => :serializer do
let(:organization) { build(:organization, :name => 'Save Dave') }
let(:user) { build(:user, :name => 'John Doe', :image => 'ugly-picture.jpg') }
let(:player) { build(:player, :organization => organization, :user => user, :finished_at... |
class CreateEpisodes < ActiveRecord::Migration
def change
create_table :episodes do |t|
t.integer :season
t.integer :episode_number
t.string :title
t.date :airdate
t.integer :show_id
end
add_index :episodes, :show_id
end
end
|
module Watchdog
class Error < StandardError
def initialize(meth, from, to)
mtype = to.is_a?(Module) ? '#' : '.'
super self.class::MESSAGE % [from, "#{to}#{mtype}#{meth}"]
end
end
class MethodExistsError < Error
MESSAGE = "%s not allowed to redefine existing method %s"
end
class Exten... |
# == Schema Information
#
# Table name: projects
#
# id :integer not null, primary key
# name :string(255)
# created_at :datetime not null
# updated_at :datetime not null
#
class Project < ActiveRecord::Base
has_many :team_memberships, conditions: { invitation_accepted: true }... |
# ------------
# Question #1
# ------------
# class SecretFile
# attr_accessor :log
# attr_reader :data
# def initialize(secret_data, log)
# @data = secret_data
# @log = log
# end
# def display_data
# log.create_log_entry
# puts data
# end
# end
# class SecurityLogger
# def create_log_... |
class ServiceContractsController < ApplicationController
breadcrumb "Service Contracts", :service_contracts_path, match: :exact
before_action :get_service_contract, except: [:index, :new, :create]
def index
@service_contracts = ServiceContract.paginate(page: params[:page], per_page: 10)
end
def show
... |
#
# Cookbook:: KafkaServer
# Spec:: Install
#
# Copyright:: 2019, The Authors, All Rights Reserved.
require 'spec_helper'
describe 'KafkaServer::Install' do
let(:chef_run) do
runner = ChefSpec::ServerRunner.new(platform: 'centos', version: '7')
runner.converge(described_recipe)
end
it 'converges succes... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.