text stringlengths 10 2.61M |
|---|
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :ensure_www
protected
def ensure_www
if Rails.env.production?
if request.host != 'www.kioskfolio.com'
redirect_to 'http://www.kioskfolio.com', :status => 301
end
end
end
end
|
class InvoiceReport < Report
VALIDATES_PRESENCE_OF = [:title, :start_date, :end_date, :sort_by, :sort_order].freeze
VALIDATES_NUMERICALITY_OF = [].freeze
require 'csv'
# A protocol with subsidy, format protocol_id column with an 's'
# A protocol without subsidy, format protcol_id column without an 's'
de... |
module Mist::GitModel::ClassMethods
def self.extended(base) #:nodoc:
base.class_attribute :default_attributes
base.default_attributes ||= HashWithIndifferentAccess.new
end
# this is necessary because without it default_attributes will be
# inherited and shared across all subclasses of base, which we
... |
# frozen_string_literal: true
RSpec.describe NotificationsController do
describe 'GET show from_admin' do
let(:notification) { FG.create(:notification_from_admin) }
it 'returns OK' do
get :show, params: { id: notification.id }
expect(response).to have_http_status(:ok)
end
end
end
|
require 'active_support/core_ext/module/delegation'
module Buckaroo
module Ideal
#
# A class to help with the generation of payment forms for the Buckaroo
# Payment Gateway.
#
# A form has a number of required parameters that are retreived from the
# +Buckaroo::Idea::Order+:
# * +currenc... |
class Portfolio < ActiveRecord::Base
belongs_to :user
has_many :holdings, dependent: :destroy
end
|
class RemovedepartmentFromDesignations < ActiveRecord::Migration
def change
remove_column :designations, :department, :string
end
end
|
class CreateReservations < ActiveRecord::Migration[6.0]
def change
create_table :reservations do |t|
t.string :f_name
t.string :l_name
t.integer :phone_num
t.integer :year
t.string :make
t.string :model
t.string :repair
t.datetime :date
t.references :user, nul... |
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
before_action :configure_permitted_parameters, if: :devise_controller?
def configure_permitted_parameters
... |
class CreateLostPets < ActiveRecord::Migration[5.2]
def change
create_table :lost_pets do |t|
t.string :animal_type
t.string :name
t.string :gender
t.string :breed
t.string :city
t.string :state
t.string :personality
t.boolean :chipped, default: false
t.string... |
require File.join(File.dirname(__FILE__), 'test_helper')
require 'action_controller/record_identifier'
require 'action_controller/polymorphic_routes'
# test_helper
# -----------
class Test::Unit::TestCase
attr_reader :form_helper
def setup
@form_helper = FormHelperTester.new
end
private
end
# label... |
class ChangeTaxratesPercentageTo3Decimals < ActiveRecord::Migration
def up
change_column :tax_rates, :percentage, :decimal, :precision => 8, :scale => 3
end
def down
change_column :tax_rates, :percentage, :decimal, :precision => 8, :scale => 3# don't let down work.
end
end
|
class CreateContents < ActiveRecord::Migration
def self.up
create_table :contents do |t|
t.column :category, :string
end
end
def self.down
drop_table :contents
end
end
|
class BookCommentsController < ApplicationController
def create
@book = Book.find(params[:book_id])
@user = @book.user
comment = current_user.book_comments.build(book_comment_params)
comment.book_id = @book.id
comment.save
end
def destroy
@book = Book.find(params[:book_id])
@user = @book.us... |
require 'rails_helper'
feature 'user sign in and out' do
scenario 'with valid info' do
user = create(:user)
sign_in_as(user)
click_link 'Sign Out'
expect(page).to have_link('Sign In')
end
scenario 'with invalid info' do
user = build(:user)
sign_in_as(user)
expect(page).to have_lin... |
$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
require 'appscale_tools'
require 'rubygems'
require 'flexmock/test_unit'
class TestAppScaleGatherLogs < Test::Unit::TestCase
def setup
# place in mocks for file reading and creation so that we
# have to explicitly state in our tests which actions a... |
require_relative './spec_helper'
include Playercenter::Backend
ENV['QS_AUTH_BACKEND_URL'] = 'http://auth-backend.dev'
API_APP = API.new
AUTH_APP = Auth::Backend::App.new(test: true)
module Auth
class Client
alias raw_initialize initialize
def initialize(url, options = {})
raw_initialize(url, option... |
# frozen_string_literal: true
# Authorizations for categories
class CategoryPolicy < ApplicationPolicy
def update?
record_belongs_to_user?
end
def destroy?
record_belongs_to_user?
end
end
|
class AddSubjectHeadToStory < ActiveRecord::Migration[5.2]
def change
add_column :stories, :subject_head, :string
add_column :stories, :kind, :string
end
end
|
class Api::UsersController < Api::ApiController
skip_before_action :authenticate_user_from_token!, only: [:create, :verify_otp]
before_action :authenticate_user!, except: [:create, :verify_otp]
def create
@user = User.new user_params
@user.inactive = true
if @user.save
if (@invitation = Invitat... |
=begin
You have a set of rows with names of famous writers encoded inside. Each row is divided into 2 parts by pipe char (|).
The first part has a writer's name. The second part is a "key" to generate a name.
Your goal is to go through each number in the key (numbers are separated by space) left-to-right.
Each number ... |
require 'net/http'
require 'json'
require 'date'
require 'time'
module Omnisana
class Client
attr_accessor :api_key
def initialize( api_key: "" )
puts "API Key: #{api_key}"
self.api_key = api_key
end
def query_api( uri )
uri = URI('https://app.asana.com/api/1.0' + uri)
#... |
class User
include ActiveModel::Serialization
attr_accessor :name, :bio
def initialize
self.name = Faker::Name.name
self.bio = Faker::Lorem.paragraph(5)
end
end
|
class Api::V1::BaseController < ApplicationController
skip_before_action :verify_authenticity_token
rescue_from ActiveRecord::RecordNotFound, with: :not_found
rescue_from ActionController::ParameterMissing, with: :malformed_request
private
def authenticate_api_user
authenticate_or_request_with... |
class AddTweetToGuesses < ActiveRecord::Migration
def change
add_column :guesses, :tweet_id, :integer
end
end
|
class AverageReview < ActiveRecord::Migration
def change
add_column :bathrooms, :average_review, :integer
end
end
|
require 'spec_helper'
describe PeopleController do
render_views
describe "GET 'new'" do
before(:each) do
sign_in FactoryGirl.create(:user)
end
it "should be successful" do
get 'new'
response.should be_success
end
it "should have the right title" do
get 'new'
res... |
class Template < ApplicationRecord
belongs_to :user
validates :description, presence: true
validates_uniqueness_of :title,:message => '%{value} has already been taken'
end
|
require "meshgrid/version"
require "numo/narray"
module Meshgrid
class Error < StandardError; end
module_function
# Arg narray is just Array: But it should contain NArrays.
def meshgrid(*narray, indexing: false)
len = narray.length
org_ary = narray.map {|nar| nar.to_a }
made_ary = Array.new(... |
class UsersController < ApplicationController
before_filter :set_user, only: [:show, :edit, :update, :destroy]
before_filter :authenticate_user!
before_filter :authenticate_admin!, only: [:index, :new, :create, :destroy]
def index
@users = User.all
end
def new
@user = User.new
end
def show
resp... |
module Footnotes
module Notes
class DevCenterNote < AbstractNote
# This method always receives a controller
#
def initialize(controller)
@controller = controller
end
# Set href field for Footnotes links.
# If it's nil, Footnotes will use '#'.
#
def link
... |
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_action :is_login?
private
def is_login?
# sessionidがある場合、現在のuser情報を取得する
if session[:user_id]
@current_user = User.find_by(id: session[:user_id])
else
# loginページに飛ばす。※sission create、user cr... |
require 'spec_helper'
describe SplitIoClient::Api::Splits do
let(:splits_api) { described_class.new('', config, metrics) }
let(:config) { SplitIoClient::SplitConfig.new }
let(:metrics_repository) { SplitIoClient::Cache::Repositories::MetricsRepository.new(config.metrics_adapter, config) }
let(:metrics) { Split... |
require "rails_helper"
feature "Projects" do
scenario "index" do
Project.create!(name: "My Test Project")
visit root_path
click_on "projects-footer-action"
expect(page.current_path).to eq(projects_path)
end
feature "Creating a Project" do
scenario "new page" do
visit root_path
... |
class Product
attr_accessor :id, :name, :quantity, :document_id
def initialize(id:, name:, quantity:, document_id: nil)
self.id = id
self.name = name
self.quantity = quantity
self.document_id = document_id
end
def attributes
{ id: id, name: name, quantity: quantity }
end
end
|
class RemoveEmailIndexFromUsers < ActiveRecord::Migration
def up
remove_index :users, :column => :email
end
def down
add_index :users, :column => :email, :name => "index_users_on_email", :unique => true
end
end
|
# Be sure to run `pod spec lint MiniShop.Shared.podspec'
Pod::Spec.new do |s|
s.name = "MiniShop.Shared"
s.version = "0.0.1"
s.summary = "Given pod provides very basic shared entities for MiniShop project"
s.description = <<-DESC
So at the moment MiniShop.Shared pod contains Product entity, which is used in... |
class Post < ActiveRecord::Base
include ApplicationHelper
belongs_to :category, :counter_cache => :count
has_many :post_tags, dependent: :destroy
has_many :tags, :through => :post_tags
accepts_nested_attributes_for :post_tags
validates :title, presence: true, length: { maximum: 100 }
validates :slu... |
class Api::V1::NotebooksController < Api::V1::BaseController
before_action :authenticate_user!
def index
@notebooks = current_user.notebooks
respond_with @notebooks
end
def show
@notebook = current_user.notebooks.find(params[:id])
respond_with @notebook
end
def create
@notebook = cu... |
# 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
#... |
require 'test_helper'
class EnfoqueMateriaControllerTest < ActionDispatch::IntegrationTest
setup do
@enfoque_materium = enfoque_materia(:one)
end
test "should get index" do
get enfoque_materia_url
assert_response :success
end
test "should get new" do
get new_enfoque_materium_url
assert_... |
class AddConveravatarsToArticles < ActiveRecord::Migration
def change
add_column :articles, :converavatars, :text
end
end
|
module Kernel
def Hash(value)
value.to_h
rescue
raise ArgumentError, "invalid value for Hash(): #{value.inspect}"
end
end
class Object
def to_h
if respond_to? :to_hash
to_hash
elsif respond_to? :all? and not all? {|item| item.respond_to? :to_ary }
Hash[*self]
else
Hash[sel... |
class FindingTechnology < ApplicationRecord
belongs_to :finding
belongs_to :technology
end
|
$: << File.expand_path('../lib', __FILE__)
Gem::Specification.new do |s|
s.name = 'rack-lineprof'
s.version = '0.0.4'
s.description = 'Rack middleware for rblineprof (github.com/tmm1/rblineprof)'
s.summary = 'Makes line-by-line source code profiling easy.'
s.license = 'MIT'
s.files ... |
class CreateTableBars < ActiveRecord::Migration
def change
create_table :table_bars do |t|
t.integer :number
t.boolean :status, default: false
t.timestamps null: false
end
add_index :table_bars, :number, unique: true
end
end
|
class ApplicationController < ActionController::Base
protect_from_forgery
private
def authorize_user
unless (@user = User.find_by_id(session[:user_id]))
redirect_to login_url, :notice => "Please Log In"
end
end
def authorize_admin
authorize_user
if @user
r... |
module Legion
module Transport
module Exchanges
class Node < Legion::Transport::Exchange
def exchange_name
'node'
end
end
end
end
end
|
class UsersController < ApplicationController
def index
@users = User.all
@title = "The Staff Room"
end
# show page is 'profile' page, includes user's own posts and short form to create
# new post. Set instance variables for all three.
def show
@post = Post.new
@user = User.find params[:id]... |
class Work < ApplicationRecord
has_many :votes, dependent: :destroy
CATEGORIES = ["album", "book", "movie"]
validates :title, presence: true
validates :category, inclusion: { in: CATEGORIES }
validates_uniqueness_of :title, scope: :category
def self.top_media(category)
works = Work.all.where(category... |
class Resource < ActiveRecord::Base
attr_accessible :title, :uri, :category, :data
belongs_to :resource_host, :polymorphic => true
#categories 0:liul.net, 1:douban-book, 2:github, -1:other
before_save :parse_category
def == r
r.title == self.title && r.uri == self.uri
end
def parse_category
... |
require 'spec_helper'
describe Store::SessionsController do
# Controller Shared Methods
#----------------------------------------------------------------------------
def do_get_new
@request.env["devise.mapping"] = Devise.mappings[:store]
get :new, :format => 'html'
end
def do_post_create(attributes)... |
class PutDefaultOfZeroOnLineItemsSubjectCount < ActiveRecord::Migration
def up
change_column :line_items, :subject_count, :integer, default: 0
LineItem.where(subject_count: nil).update_all(subject_count: 0)
end
def down
change_column :line_items, :subject_count, :integer
end
end
|
# This is a class that literally does nothing on purpose. It is used as an
# Carrierwave storage provider in the test suite so we don't litter the
# filesystem, thereby speeding up tests significantly.
class NullStorage
def initialize(uploader)
@uploader = uploader
end
def identifier
@uploader.filename
... |
# frozen_string_literal: true
FactoryBot.define do
factory :glyc_member do
sequence(:email) { |n| "someone.#{n}@example.com" }
end
end
|
require "sinatra"
require "sinatra/synchrony"
require "redis"
require "pg"
require "dalli"
require "active_support/secure_random"
def redis_connection_hash(env)
uri = URI.parse(env)
{ :host => uri.host, :port => uri.port, :password => uri.password,
:driver => :synchrony }
end
def constantize(camel_cased_word)
... |
require './lib/van'
describe Van do
let(:van){ Van.new(:capacity => 30) }
let(:station){ DockingStation.new(:capacity => 123) }
let(:bike){ Bike.new }
let(:bike2){ Bike.new }
let(:garage){ Garage.new(:capacity => 1000) }
def fill_van(van)
30.times { van.dock(Bike.new) }
end
it "should allow setting defau... |
class Piece
attr_reader :board, :color
attr_accessor :pos
def initialize(color, board, pos)
@color = color
@board = board
@pos = pos
@board.add_piece(pos, self)
end
def moves
raise "not yet implemented!"
end
def legal_moves
moves.reject { |move| leaves_king_in_check?(move) }
... |
require 'spec_helper'
describe "tailgate_venues/show" do
before(:each) do
@theVenue = stub_model(Venue, name:"joes")
@theTailgate = stub_model(Tailgate, name:"party")
@tailgate_venue = assign(:tailgate_venue, stub_model(TailgateVenue,
:tailgate => @theTailgate,
:venue => @theVenue,
:lat... |
module Finance
def self.table_name_prefix
'finance_'
end
end
|
class Education < ApplicationRecord
before_create :set_position
has_one :experience, as: :experienceable, dependent: :destroy
def set_position
last_position_number = Education.maximum(:position_number)
self.position_number = last_position_number.to_i + 1
end
end
|
class AddMappingToSourceMap < ActiveRecord::Migration
def up
execute <<-SQL
ALTER TABLE source_maps
ADD COLUMN "from" CHARACTER VARYING(24) NOT NULL DEFAULT 'minified' CHECK (CHAR_LENGTH("from") > 0),
ADD COLUMN "to" CHARACTER VARYING(24) NOT NULL DEFAULT 'original' CHECK (CHAR_LENGTH("to") ... |
class AddIndices < ActiveRecord::Migration
def up
add_index 'entities', 'uuid', :unique => true
end
def down
end
end
|
require './talent_module'
class John
include Hobbie
attr_accessor :name, :age, :gender, :talents
def initialize(name, age, gender, talents)
@name = name
@age = age
@gender = gender
@talents = talents
end
def has_talents
self.talents = self.build_talent_array
end
end
john = John.ne... |
class IO
# Yields compressed block, expected size of uncompressed data,
# and expected CRC32 of uncompressed data.
def each_bgzf
while not eof? do
magic, gzip_extra_length = read(12).unpack('Vxxxxxxv')
raise 'wrong BGZF magic' unless magic == 0x04088B1F
len = 0
bsize = nil
wh... |
Given(/^there is a post titled with "(.*?)" and content with "(.*?)"$/) do |arg1, arg2|
@title = arg1
@post = Post.create!({ :title => arg1, :content => arg1, :post_time => Time.now })
end
When(/^I am on the post page$/) do
visit("/posts")
end
When(/^I select a post$/) do
puts "Visiting #{post_url @post}"
page... |
class CreateActivities < ActiveRecord::Migration
def change
create_table :activities do |t|
t.float :hours, default: 0.0
t.date :date, null: false
t.integer :user_id, null: false
t.timestamps
end
add_index :activities, :user_id
end
end
|
module Reflect
class Template
include NoBrainer::Document
field :name
field :body
validates :name, :body, :presence => true
end
end |
class AddSupplierWorkingToDialogues < ActiveRecord::Migration
def change
add_column :dialogues, :supplier_working, :boolean
end
end
|
class ReportsController < ApplicationController
# sets the @auth object and @object
before_filter :get_obj_auth
before_filter :modelperms
def list_reports
reports = []
reports << ['Nodes not assigned to racks', :racks_unassigned]
reports << ['Nodes not updated', :have_not_updated]
reports << ['... |
class RenameTypeColumnToTypecdFromPersons < ActiveRecord::Migration
def change
rename_column :persons, :type, :type_cd
end
end
|
module OrientdbBinary
module BaseProtocol
class DbClose < BinData::Record
endian :big
int8 :operation, value: OrientdbBinary::OperationTypes::REQUEST_DB_CLOSE
int32 :session
def process(connection)
write(connection.socket)
end
end
end
end
|
# frozen_string_literal: true
class FixScheduleRuleProductIndex < ActiveRecord::Migration
def up
add_index :schedule_rules, :product_id
end
end
|
# frozen_string_literal: true
module GabApi
class TransactionalError < RuntimeError
attr_reader :response
def initialize(response, extra_message = nil)
@response = response
msg_parts = ["Status: #{response.first} - #{response.last}"]
msg_parts << ": #{extra_message}" unless extra_message.n... |
class Mactracker < Cask
url 'http://www.mactracker.ca/downloads/Mactracker_7.2.1.zip'
homepage 'http://mactracker.ca/'
version '7.2.1'
sha1 '90d244a16b24894ded0c67ae19aceb767f84f1b9'
link 'Mactracker.app'
end
|
Given("that user access website") do
@m_Page = LoginPageUtils.new
@m_Page.load
# @m_Page.load(account_query: {'controller': 'contact'})
end
Given("that user access the authentication page") do
@m_Page.m_SignInButton.click
expect(page).to have_selector('#email_create')
end
Given("user can add your ... |
class Team < ApplicationRecord
has_many :local_matches, class_name: "Match", foreign_key: "local_team_id"
has_many :visiting_matches, class_name: "Match", foreign_key: "visiting_team_id"
validates :name, presence: true, uniqueness: true
def can_be_destroyed?
local_matches.empty? && visiting_matche... |
require 'property_location_constraint'
require 'PropertyConstraint'
class PropertyLocationsController < ApplicationController
include PropertiesHelper
include SessionsHelper
before_action :signed_in_user
def new
@location = PropertyLocation.new
end
def create
params = property_location_params
... |
require "cabin/namespace"
module Cabin
module Inspectable
# Provide a saner inspect method that's easier to configure.
#
# By default, will inspect all instance variables. You can tune
# this by setting @inspectables to an array of ivar symbols, like:
# [ :@hello, :@world ]
#
# cl... |
module JsonApiTestHelpers
module Response
def json_response
if response.body.present?
parsed_json = JSON.parse response.body
parsed_json.with_indifferent_access unless parsed_json.is_a? Array
else
raise 'Response body is empty'
end
end
def json_api_record(record,... |
PROTOCOL_V2_0 = 2000000
Before do
@blocks = {}
@addresses = {}
@nodes = {}
@tx = {}
@raw_tx = {}
@raw_tx_complete = {}
@pubkeys = {}
@unit = {}
@time = Time.utc(2014, 9, 1, 0, 0, 0)
end
def timeshift
(@time - Time.now).to_i
end
def time_travel(seconds)
@time += seconds
@nodes.values.each do |... |
require 'rails_helper'
include AdminHelpers
RSpec.feature 'Deleting recruitment' do
before do
@hr = create(:hr)
assign_permission(@hr, :read, Recruitment)
assign_permission(@hr, :destroy, Recruitment)
login_as(@hr, scope: :hr)
@recruitment = create(:recruitment)
visit admin_recruitments_path
... |
require 'rubygems'
# require 'icalendar'
require 'vendor/icalendar-1.1.0/lib/icalendar'
require 'date'
module ToIcalendarProxy
include Icalendar
def to_icalendar
cal = Calendar.new
self.map do |element|
cal.add_event(element.to_icalendar_event)
end
return cal
end
end |
module Admin
class CongressmenController < BaseController
load_and_authorize_resource
def create
@congressman = Congressman.new(congressman_params)
errors_to_flash(@congressman) unless @congressman.save
redirect_to :back
end
def update
if @congressman.update(congressman_param... |
class CreatePosts < ActiveRecord::Migration
def change
create_table :posts do |t|
t.string :p_img
t.string :p_title
t.string :p_uploader
t.date :p_shooted_day
t.string :p_flower
t.integer :p_area
t.text :p_memo
t.integer :p_like_count
t.integer :p_repo... |
require "minitest/autorun"
require "nidyx" # we use some core_ext stuff that requires this
require "nidyx/parser"
class TestParser < Minitest::Test
def test_description
schema = {
"type" => "object",
"properties" => {
"key" => {
"description" => "a description",
"type" => ... |
require 'addressable/uri'
module UrlsHelper
def valid_url?(url)
parsed = Addressable::URI.parse(url) or return false
!parsed.scheme.nil?
rescue Addressable::URI::InvalidURIError
false
end
end
|
if %w[development test].include? Rails.env
require "scss_lint/rake_task"
namespace :lint do
desc "Run SCSS Lint"
task scss: :environment do
SCSSLint::RakeTask.new
end
end
end
|
class StaffController < ApplicationController
layout "application"
respond_to :json
def index
@staff = Staff.all
respond_to do |format|
format.html
format.json { render json: @staff }
end
end
def show
@staff = Staff.find(params[:id])
respond_to do |format|
format.html... |
Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
root 'welcome#home'
scope '/api' do
resources :songs, only: [:create,:update,:show,:index,:destroy]
resources :users, only: [:create,:update,:show,:index,:destroy]
r... |
require 'sinatra/base'
class User
attr_reader :id, :email, :password, :name, :username
def initialize(id, email, password, name, username)
@id = id
@email = email
@password = password
@name = name
@username = username
end
def self.create(email, password, name, username)
result = data... |
# Encoding: utf-8
require 'csv'
def most_successfull(number, max_year, file_name)
#TODO: return the number most successfull movies max_year
array = []
CSV.foreach(file_name, encoding: "iso-8859-1:UTF-8") do |row|
info_film = {
name: row[0].to_s,
max_year: row[1].to_i,
earnings: row[2].to_i
}
... |
require 'spec_helper'
describe "Account Communication Retrieval" do
describe "self.get_acct_invoice_history(params)",:vcr do
it "Returns the invoice history for a specified account" do
response = api.get_acct_invoice_history({ "acct_no" => 1 })
response.should have_key("error_code")
response.s... |
#CLI controller
class CLI
BASE_URL = "https://animalcrossing.fandom.com"
def call
welcome
# Create classes, add class variables (@@info for learn section)
Scraper.info_scrape("https://animalcrossing.fandom.com/wiki/Villager")
# Instantiate instances
Scraper.initial_scra... |
require 'rails_helper'
RSpec.describe CompleteCard, type: :model do
it { should belong_to :color }
it { should belong_to :rarity }
it { should belong_to :card }
it { should belong_to :type }
end
|
class Admin::BaseController < ApplicationController
before_action :authenticate_user!
before_action :check_admin
layout "admin"
protected
def check_admin
redirect_to root_path, alert: 'У вас нет парв на просмотр этой страницы!' unless current_user.admin?
end
end |
require 'spec_helper'
describe QuickbooksEndpoint do
def parameters
{
'quickbooks_access_token' => "123",
'quickbooks_access_secret' => "OLDrgtlzvffzyH1hMDtW5PF6exayVlaCDxFjMd0o",
'quickbooks_realm' => "1081126165",
"quickbooks_deposit_to_account_name" => "Undeposited Funds",
"quic... |
module BasePlayer
def init(player)
player.all.each do |card|
card.destroy
end
hit(player)
hit(player)
end
def getBasicPoint(card, ace, sum)
if card[:number] < 10
if card[:number] == 1
ace += 1
end
sum += card[:number]
else
sum += 10
end
return... |
require_relative 'spec_helper'
describe Battery do
before :each do
@battery = Battery.new("Battery",25)
end
it "should be an item" do
expect(@battery).to be_an(Item)
end
it "should have name 'Battery'" do
expect(@battery.name).to eq("Battery")
end
it "should have weight 25" do
expect(@... |
class UsersController < ApplicationController
before_filter :validate_access
def validate_access
unless user_signed_in?
redirect_to root_path, alert: 'You have to log in to be able to access that part of the website' and return
end
unless current_user.admin?
redirect_to root_path, alert: ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.