text stringlengths 10 2.61M |
|---|
require "httparty"
require "oj"
require "wikia/response/activity"
require "wikia/response/article"
require "wikia/response/navigation"
require "wikia/response/recommendation"
require "wikia/response/related_page"
module Wikia
class Client
class Config
attr_reader :domain, :debug
def initialize(domain... |
class PostsController < ApplicationController
def index
@posts = Post.active.includes(:tags).order('created_at desc').page(params[:page]).per(5)
@posts = @posts.tagged_with(params[:tag]) unless params[:tag].blank?
@tags = Post.active.tag_counts(:order => 'name asc')
end
def show
if params[:id].i... |
class Bowling
attr_accessor :total
def initialize
@total = 0
end
def play(move)
move.to_i
@total += move
end
end
|
require 'spec_helper'
describe Article do
after :all do
Article.destroy_all
Author.destroy_all
DataFile.destroy_all
end
it 'should have title' do
Article.new(title: '').should_not be_valid
end
it 'should have status' do
Article.new(title: 'test', status: nil).should_not be_valid
end
... |
#!/usr/bin/ruby
# This example demonstrates the memento pattern in the Ruby language.
class Originator
def initialize
@state = self.inspect
end
def set_memento(memento)
@state = memento.get_state
end
def create_memento
return Memento.new(@state)
end
end
class Memento
def initialize(... |
module Rmega
module Crypto
module AesCtr
def aes_ctr_cipher
OpenSSL::Cipher::AES.new(128, :CTR)
end
def aes_ctr_decrypt(key, data, iv)
cipher = aes_ctr_cipher
cipher.decrypt
cipher.iv = iv
cipher.key = key
return cipher.update(data) + cipher.final... |
class AddServiceProviderToStatusChanges < ActiveRecord::Migration
def self.up
add_column :status_changes,:service_provider, :string
add_column :status_changes,:department, :string
end
def self.down
remove_column :status_changes,:service_provider
remove_column :status_changes,:department
end
end... |
require 'spec_helper'
describe "characters_instances/new" do
before(:each) do
assign(:characters_instance, stub_model(CharactersInstance,
:character_guid => 1,
:instance_id => 1
).as_new_record)
end
it "renders new characters_instance form" do
render
# Run the generator again with t... |
class RemoveIssueDateFromCashExpenses < ActiveRecord::Migration
def change
remove_column :cash_expenses, :issue_date, :date
remove_column :cash_expenses, :actual_date, :date
remove_column :cash_expenses, :actual_amount, :decimal
end
end
|
class DayTypesController < ApplicationController
before_action :set_day_type, only: [:show, :edit, :update, :destroy]
# GET /day_types
# GET /day_types.json
def index
@day_types = DayType.all
end
# GET /day_types/1
# GET /day_types/1.json
def show
end
# GET /day_types/new
def new
@day_t... |
class Project < ApplicationRecord
belongs_to :user
has_many_attached :images
has_and_belongs_to_many :tags, uniq: true
attr_accessor :tag_names
def tag_names=(names)
@tag_names = names
@tag_names.split(' ').each do |name|
self.tags << Tag.find_or_create_by(name: name.upcase)
end
end
end
|
FactoryGirl.define do
factory :manufacturer do
name "Stark Industries"
end
end
|
class Post
include FakeModel
fake_columns :body, :subject, :title
end
|
class Npth < Package
name 'npth'
desc "The New GNU Portable Threads"
homepage "https://github.com/gpg/npth"
url "https://www.gnupg.org/ftp/gcrypt/npth/npth-${version}.tar.bz2"
release version: '1.5', crystax_version: 1
build_copy 'COPYING.LIB'
build_libs 'libnpth'
def build_for_abi(abi, _toolchain, ... |
FactoryGirl.define do
factory :link do
title 'Some Page'
path '/some-page'
weight 5
end
end
|
require 'spec_helper'
describe SessionsController do
describe "GET 'new'" do
it "returns http success" do
get 'new'
response.should be_success
end
end
describe "POST 'create'" do
it "should get create" do
get :create
response.should be_success
end
end
describe "DELE... |
# encoding: utf-8
# copyright: 2016, you
# license: All rights reserved
# date: 2015-08-28
# description: All directives specified in this STIG must be specifically set (i.e. the server is not allowed to revert to programmed defaults for these directives). Included files should be reviewed if they are used. Procedure... |
class AddEvtcatagoryIdToEventTags < ActiveRecord::Migration[5.2]
def change
add_column :tags, :description, :text
add_column :event_tags, :evtcategory_id, :integer
end
end
|
=begin
Write a method that counts the number of occurrences of each element in a given array.
Example:
vehicles = [
'car', 'car', 'truck', 'car', 'SUV', 'truck',
'motorcycle', 'motorcycle', 'car', 'truck'
]
count_occurrences(vehicles)
Expected output:
car => 4
truck => 3
SUV => 1
motorcycle => 2
=en... |
class Invoice < ActiveRecord::Base
has_many :sold_items
has_many :additional_charges
has_many :discounts
has_many :sales_user_details,:dependent => :destroy
has_one :finance_transaction, :as => :finance
validates_uniqueness_of :invoice_no, :scope => :store_id
belongs_to :store
belongs_to :financial_year... |
class Api::V1::UsersController < Api::V1::BaseController
respond_to :json
#TODO 具体返回的参数还是要调整 暂时仅保证一个可用版本
before_action :set_user, only: [:show, :update, :destroy]
# GET
def index
@users = User.all
render json: @users
end
# GET
def show
if @user
render json: @user, status: 200
... |
# frozen_string_literal: true
class EtsPdf::Etl::PdfConverter < SimpleClosure
PDF_EXTENSION = ".pdf"
def initialize(pdf_pattern)
@pdf_pattern = pdf_pattern
end
def call
convert
@pdf_pattern
end
private
def convert
Dir.glob(pdfs_path).each do |pdf_path|
next if txt_exists?(pdf_pa... |
# frozen_string_literal: true
class StatusUpdatePolicy
attr_reader :user, :status_update
def initialize(user, status_update)
@user = user
@status_update = status_update
end
def create?
true
end
def edit?
owner?
end
def update?
owner?
end
def destroy?
owner?
end
def... |
module Tandaco
class BaseRequest
include APIClientBase::Request.module(default_opts: :default_opts)
attribute :token, String
private
def headers
auth = "Bearer #{default_opts[:token]}"
{ 'Cache-Control' => 'no-cache', 'Authorization' => auth }
end
def default_opts
{ token:... |
Rails.application.routes.draw do
devise_for :users
resources :socks, except: :destroy do
collection do
get :my_socks
end
resources :bookings, only: %i[new create show]
end
resources :users, only: :show
root to: 'pages#home'
# For details on the DSL available within this file, see https://g... |
# frozen_string_literal: true
require 'test_helper'
module Vedeu
describe ApplicationController do
let(:described) { Vedeu::ApplicationController }
let(:instance) { described.new(params) }
let(:params) { {} }
describe '#initialize' do
it { instance.must_be_instance_of(described) }
... |
require 'optparse'
module Vagrant
module Command
class BoxList < Base
def execute
options = {}
opts = OptionParser.new do |opts|
opts.banner = "Usage: vagrant box list"
end
# Parse the options
argv = parse_options(opts)
return if !argv
bo... |
# encoding: utf-8
lib = File.expand_path('../lib/', __FILE__)
$:.unshift lib unless $:.include?(lib)
require 'figroll/version'
Gem::Specification.new do |gem|
gem.name = "figroll"
gem.version = Figroll::VERSION
gem.author = "EY Cloud Team"
gem.email = "cloud@engineyard.com"
gem.summary = "... |
module Sections
class Sheets < SitePrism::Section
elements :buttons, :class, 'XCUIElementTypeButton'
end
end
|
class Song < ActiveRecord::Base
validates :title, presence: true
validates :release_year, presence: true, if: :released?
validate :release_year_cannot_be_in_the_future
validate :cannot_release_song_twice_in_a_year
def release_year_cannot_be_in_the_future
if release_year.present? && release_year > Date.to... |
FactoryBot.define do
factory :group_chat_room do
owner_id { 42 }
room_type { "public" }
title { Faker::Game.title[1..20] }
max_member_count { 10 }
channel_code { Faker::Games::Pokemon.unique.name[1..20] }
password { nil }
end
end |
require 'rails_helper'
RSpec.describe 'Test request endpoint', type: :request do
context 'with valid username and password' do
include_context 'with database config set'
include_context 'with valid login for atos'
let(:default_headers) do
{
'Authorization' => auth_header_value
}
... |
require 'omf_web'
require 'omf_base/lobject'
require 'omf_oml/table'
require 'omf_oml/sql_source'
class LazySlicableTable < OMF::Base::LObject
attr_reader :name
# attr_accessor :max_size
attr_reader :schema
# attr_reader :offset
def initialize(name, schema, &block)
@name = name
@schema = schema
@... |
require 'pg'
require_relative '../secrets'
class DBClient
def initialize
root_path = File.expand_path('../..', __FILE__)
config=YAML.load_file(File.join(root_path, 'config', 'database.yml'))[ENV["RACK_ENV"]]
@conn = PG.connect(
dbname: config["database"],
host: confi... |
class AddNombreTipoToProyectos < ActiveRecord::Migration
def change
add_column :proyectos, :tipo, :integer
end
end
|
namespace :php_fpm do
desc "Reload PHP5-FPM (requires sudo access to /usr/sbin/service php5-fpm reload)"
task :reload, :roles => :app do
run "sudo /usr/sbin/service php5-fpm reload"
end
end |
def k_sparse_binary_count(s, t, k)
number_of_k_sparses = 0
limit = 1_000_000_006
limit_division = 1_000_000_007
(s.to_i(2)..t.to_i(2)).to_a.each do |number|
next if invalid?(number, k)
next if invalid2?(number)
if valid?(number, k)
number_of_k_sparses += 1
next
end
number = nu... |
class FileEntitiesController < ApplicationController
# before_filter :login_required,:only=>[:upload]
def upload
file_entity_id = params[:file_entity_id]
file_name = params[:name]
file_size = params[:size]
blob = params[:blob]
if file_entity_id.blank?
file_entity = FileEntity.c... |
module SDC
class BaseGame
attr_reader :dt, :meter, :second
attr_accessor :gravity
def initialize
# Distance unit in pixels
@meter = 50.0
# Time unit in frames
@second = 60.0
# Physics time step
@dt = 1.0
# Gravity
@gravity = SDC::Coordinates.new(0, 30.0) * (@meter / @second**2)
#... |
FactoryGirl.define do
factory :promotion do
title { Faker::Lorem.words(5).join(" ") }
tagline { Faker::Lorem.words(5).join(" ") }
summary { Faker::Lorem.words(10).join(" ") }
description { Faker::Lorem.paragraph(1) }
image Rack::Test::UploadedFile.new(File.open(File.join(Rails.root, '/spec/fixture... |
class Job < ApplicationRecord
validates :title, presence: true
has_many :job_collections
has_many :job_collectors, through: :job_collections, source: :user
validates :wage_upper_bound, presence: true
validates :wage_lower_bound, presence: true
validates :wage_lower_bound, numericality:{ greater_than: 0 }
... |
class Category < ActiveRecord::Base
has_many :product_category
validates :name, :presence => true
validates :tag, :presence =>true
validates_uniqueness_of :name
validates_uniqueness_of :tag
end
|
class GoodreadsAdapter
class << self
def reviews(user_id, page = 1, per_page = 200, params = {})
results = client.reviews(params.merge(id: user_id, page: page, per_page: per_page))
results.each do |review|
review.read_at = Date.parse(review.read_at) if review.read_at.present?
end
end... |
FactoryBot.define do
factory :simple_contact, class: Contact do
first_name { Faker::Name.first_name }
last_name { Faker::Name.last_name }
end
factory :dsc_contact, class: Contact do
title Contact.titles.keys.sample
suffix ""
first_name { Faker::Name.first_name }
last_name { Faker::Name.l... |
FactoryGirl.define do
factory :user do
sequence( :first_name) { |n| "Testy#{n}"}
sequence( :last_name) { |n| "McTesterson#{n}" }
sequence( :email) {|n| "testy#{n}@gunpowder.ucsd.edu" }
password "123456"
password_confirmation "123456"
end
factory :document do
eaf { File.open(File.join(Rails... |
require_relative 'utils/constants'
require_relative 'error'
require 'base64'
require 'net/http'
require 'json'
API_VERSION = '/v2'
module AlgoSDK
class IndexerClient
def initialize(indexer_token, indexer_address, headers)
@indexer_token = indexer_token
@indexer_address = indexer_address
@head... |
require 'spec_helper'
describe 'Adding and removing tags' do
let(:venue) { create(:venue) }
let(:no_takeaway) { create(:tag, :no_takeaway) }
let(:expired_tag) { create(:tag, :expired) }
it 'stores new tags' do
venue.tags << no_takeaway
expect(venue.tags).to include(no_takeaway)
end
it 'removes e... |
$:.unshift '.';require File.dirname(__FILE__) + '/helper'
module EchoNest
class ResponseTest < Test::Unit::TestCase
should "create a hashie mash of data" do
json = '{"response": {"status": {"version": "4.2", "code": 0, "message": "Success"}, "artist": {"id": "ARZGTK71187B9AC7F5", "name": "Eels"}}}'
... |
class RenameColumnInDances < ActiveRecord::Migration
def change
remove_column :dances, :song_id
add_column :dances, :song, :string
end
end
|
require_relative './chess_node'
class ComputerPlayer
attr_reader :board, :color, :display, :name
def initialize(color, board, display)
@name = "ChessBot"
@color = color
@board = board
@display = display
end
def play_turn
display.render(name)
best_moves.sample.move
end
def best_m... |
require 'rspec_helper'
describe Matrix3d do
it "should store things correctly" do
m = Matrix3d.new 2, 3, 4
m[0, 0, 0] = 'on 0 0 0'
m[0, 0, 0].should == 'on 0 0 0'
end
it "can coerce a index into a position" do
m = Matrix3d.new 4, 3, 2
m.put 1, 'a value'
m[0, 0, 1].should == 'a value'
... |
class User < ActiveRecord::Base
validates_presence_of :uid
validates :uname, uniqueness: true, allow_blank: true
has_one :overboard
has_one :replied
has_many :boards
has_many :frontpage_posts
has_many :permissions
has_many :bans
has_many :logins
def has_perm(permission)
return self.permissio... |
require "standardizer/constants"
class String
def is_integer?
/\A[-+]?\d+\z/ === self
end
end
class Address
include Constants
attr_accessor :input_address, :direction_config
attr_accessor :unit_number, :unit_type, :street_number, :street_name, :street_type, :street_type_long, :street_type_alt, :... |
module Casein
class InstallGenerator < Rails::Generators::Base
include Rails::Generators::Migration
source_root File.expand_path('../templates', __FILE__)
def self.next_migration_number dirname
if ActiveRecord::Base.timestamped_migrations
Time.now.utc.strftime("%Y%m%d%H%M%S")
else
... |
class CreateBalls < ActiveRecord::Migration
def change
create_table :balls do |t|
t.integer :student_id, null: false
t.integer :examination_id, null: false
t.decimal :value, precision: 6, scale: 1, default: nil
t.string :note
t.timestamps null: false
end
end
def ... |
# -*- encoding : utf-8 -*-
require 'test_helper'
class DissertationsControllerTest < ActionController::TestCase
setup do
@dissertation = dissertations(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:dissertations)
end
test "shou... |
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'arbitrary_mock/version'
Gem::Specification.new do |spec|
spec.name = "arbitrary_mock"
spec.version = ArbitraryMock::VERSION
spec.authors = ["Robert White"]
spec.email... |
class Api::V1::QuestionsController < Api::V1::ApiController
skip_before_action :authenticate_user_from_token!, only: [:index, :show]
before_action :authenticate_user_from_token, only: [:index, :show]
before_action :set_question, except: [:index, :create]
before_action :set_tag, only: :index
# GET /questions
... |
class RemoveLocationIdFromDependencies < ActiveRecord::Migration
def change
remove_column :dependencies, :location_id
end
end
|
class CreateSchedulesAppointments < ActiveRecord::Migration[6.1]
def change
create_table :schedules_appointments, id: false do |t|
t.integer :schedule_id
t.integer :appointment_id
t.timestamps
end
add_index :schedules_appointments, :schedule_id
add_index :schedules_appointments, :a... |
module RubyHome
module Executor
class DeviceCommand
attr_accessor :command, :device
def initialize(device, command)
self.device = device
self.command = command
end
end
end
end |
module Xeroizer
class ApiException < StandardError
attr_reader :type, :message, :xml, :request_body
def initialize(type, message, xml, request_body)
@type = type
@message = message
@xml = xml
@request_body = request_body
end
def message
... |
module Result
def self.success
Success
end
def self.failure(reason)
Failure.new(reason)
end
private
class Success
def self.unwrap(sucess_value)
sucess_value
end
end
class Failure
def initialize(reason)
@reason = reason
end
def unwrap(sucess_value)
yield ... |
require "application_system_test_case"
class AttachFilesTest < ApplicationSystemTestCase
setup do
@attach_file = attach_files(:one)
end
test "visiting the index" do
visit attach_files_url
assert_selector "h1", text: "Attach Files"
end
test "creating a Attach file" do
visit attach_files_url
... |
#!/usr/bin/ruby
# encoding: UTF-8
require 'net/http'
require 'json'
def make_post_api_call(uri, path, msg)
# puts
#puts 'Make a POST API request:'
http = Net::HTTP.new(uri)
post_request = Net::HTTP::Post.new(path)
post_request['Content-Type'] = 'application/json'
post_request['Accept'] = 'applicat... |
class Group < ActiveRecord::Base
has_many :teachings
end
|
require "test/unit"
require "./lagrange.rb"
class LagrangeTest < Test::Unit::TestCase
def test_zero_order
lagrange = Lagrange.new([1, 2])
assert_equal [2], lagrange.coefficients
end
def test_first_order
lagrange = Lagrange.new([1, 1], [2, 3.5])
assert_equal [-1.5, 2.5], lagrange.coefficients
... |
module Crawler
class Cli < ::Thor
desc 'supply_hash_numbers [FROM] [TO]', 'Supplies hash numbers'
def supply_hash_numbers(from, to)
Crawler::Redis.supply_hash_numbers(from.to_i, to.to_i)
puts "Current hash numbers: #{Crawler::Redis.connection.llen('hash_numbers')}"
end
desc 'load_seed [SE... |
class OrganisationsController < BaseApiController
before_filter :find_organisation, only: [:show, :update]
before_filter only: :update do
unless @json.has_key?('organisation')
render nothing: true, status: :bad_request
end
end
def index
render json: Organisation.all
end
def show
ren... |
class AddRelatoToCrimeWitnesses < ActiveRecord::Migration[6.0]
def change
add_column :crime_witnesses, :relato, :string
end
end
|
class CreateRestaurants < ActiveRecord::Migration
def change
create_table :restaurants do |t|
t.string :name
t.integer :qtd_delivery
t.integer :qtd_pizzaiolo
t.float :qtd_income
t.float :qtd_expense
t.integer :rating
t.timestamps
end
end
end
|
class Snippet < ActiveRecord::Base
belongs_to :user
before_save :count_lines
after_create :publish_directly
validates_presence_of :title, :code
validates_uniqueness_of :title
validates_length_of :title, :within => 4..255
has_friendly_id :title, :use_slug => true, :approximate_ascii => true
# Sta... |
VERBOSE = false
DEBUG_MAX_DEPTH = nil
$objects = []
$num_floors = 4
$solution_node = nil
$tree = []
$checked_hashes = {}
def print_node(node)
i = 0
floor_strings = []
node[:floors].each_slice($objects.length) do |floor|
str = "F#{i} "
str += node[:elevator] == i ? "E " : ". "
str += floor.map { |v| v ? "#{... |
require 'rails_helper'
describe Page do
it{ respond_to :uid }
it{ respond_to :username }
it 'stores a page with uid and username' do
Page.create!(uid: '1234', username: 'Test')
expect(Page.count).to eq 1
page = Page.first
expect(page.uid).to eq '1234'
expect(page.username).to eq 'Test'
end... |
require 'pliny/commands/generator'
require 'pliny/commands/generator/endpoint'
require 'test_helper'
describe Pliny::Commands::Generator::Endpoint do
subject { Pliny::Commands::Generator::Endpoint.new(model_name, {}, StringIO.new) }
describe '#url_path' do
let(:model_name) { 'resource_history' }
it 'buil... |
module JavaClass
module Dependencies
# A node in a Graph of dependencies. A node contains a map of dependencies (Edge) to other nodes.
# Author:: Peter Kofler
class Node
attr_reader :name
attr_reader :size
attr_reader :dependencies
### attr_reader :incoming... |
class User < ApplicationRecord
validates :username, presence: true
validates :email, presence: true,
uniqueness: true,
format: { with: /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/}
validates :password,
length: {minimum: 8, message: "は8文字以上で入力してください"},
format... |
require 'statement'
describe Statement do
subject(:statement) { described_class.new }
header = "date || credit || debit || balance\n"
transactions = [{ credit: 200, debit: 0, balance: 200, date: '20/11/2019' }]
printed_statement = "date || credit || debit || balance\n20/11/2019 || 200.00 || || 200.00\n"
prin... |
require 'sony_camera_remote_api'
require 'sony_camera_remote_api/scripts'
require 'sony_camera_remote_api/logging'
require 'sony_camera_remote_api/utils'
require 'sony_camera_remote_api/shelf'
require 'fileutils'
require 'thor'
require 'highline/import'
module SonyCameraRemoteAPI
# CLI client module
module Client... |
# -*- coding: UTF-8 -*-
=begin
Tendo como dados de entrada a altura de uma pessoa, construa um algoritmo que
calcule seu peso ideal, usando a seguinte fórmula: (72.7*altura) - 58.
=end
puts "======================================================="
print "Digite sua altura: "
altura = gets.chomp
peso = ((72.7*altura... |
require 'test_helper'
class MomentumCms::Admin::PasswordResetsControllerTest < ActionController::TestCase
def setup
@site = MomentumCms::Site.first
@user = momentum_cms_users(:default)
@user.email = 'user@domain.com'
@user.password = 'passpass'
@user.password_confirmation = 'passpass'
@user.... |
class UserPolicy < ApplicationPolicy
attr_reader :user, :record, :context
def initialize(user, record, context)
@user = user
@record = record
@context = context
end
class Scope < Scope
attr_reader :user, :scope, :account_id, :incident_id
def initialize(user, scope, context)
@user = ... |
# == Schema Information
#
# Table name: reviews
#
# id :integer not null, primary key
# reviewable_id :integer
# reviewable_type :string
# text :text
# user_id :integer
# verified :boolean
# created_at :datetime not null
# updated_at :datetime ... |
#!/usr/bin/ruby
class Person
attr_accessor :name
@@times_initialized = 0
def initialize name
@@times_initialized += 1
@name = name
end
def put_name_and_profession
puts "#{@name} has no profession."
end
def put_times_initialized
puts "Initialized #{@@times_initialized} times."
end
... |
require 'spec_helper'
describe Bid do
describe "validations" do
it { should validate_presence_of :item_id }
it { should validate_presence_of :color }
it { should validate_presence_of :amount }
it { should validate_presence_of :timestamp }
end
describe "#exists" do
context "when the bid exist... |
class AddTableWidthAndTableHeightToGames < ActiveRecord::Migration
def change
add_column :games, :table_width, :integer
add_column :games, :table_height, :integer
end
end
|
# == Schema Information
#
# Table name: events
#
# id :integer not null, primary key
# location :string(255)
# starts_at :datetime
# ends_at :datetime
# hobby_id :integer
# created_at :datetime
# updated_at :datetime
#
require 'spec_helper'
describe Event do
it { should respond_to :h... |
require 'rails_helper'
RSpec.describe 'When a user visits a snack show page', type: :feature do
scenario 'they see name, price, and locations that carry said snack' do
owner = Owner.create(name: "Sam's Snacks")
dons = owner.machines.create(location: "Don's Mixed Drinks")
burger = dons.snacks.create!(nam... |
require 'rails_helper'
RSpec.feature 'Guest user' do
context 'register for an account with email and password' do
let(:email) { 'shaanjain@gmail.com' }
let(:password) { 'password' }
before do
# REGISTER
register_with(email, password)
end
context 'confirms email' do
before do
... |
Rails.application.routes.draw do
namespace :api do
namespace :v1 do
### AUTHENTICATION ###
post 'auth' => 'user_token#create'
### USERS ###
resources :users
### EVENTS ###
resources :events
### LOCATIONS ###
resources :locations
end
end
end
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe "TaskResult" do
before(:each) do
@task_result_hash = {
'task' => {
'name'=>"Approve photo please",
'callback_params' =>
{
'_task'=>{'class_name'=>'ApprovePhotoTask'},
'resource_id' => '... |
class Advert3sController < ApplicationController
before_action :set_advert3, only: [:show, :edit, :update, :destroy]
before_action :authenticate_user!
# GET /advert3s
# GET /advert3s.json
def index
@advert3s = Advert3.all
end
# GET /advert3s/1
# GET /advert3s/1.json
def show
end
# GET /adve... |
# == Schema Information
#
# Table name: emojis
#
# id :integer not null, primary key
# name :string not null
# created_at :datetime not null
# updated_at :datetime not null
# filename :string
# content_type :string
# img_binary :binary
#
class Emoji... |
module Gsa18f
class ProcurementsController < ClientDataController
protected
def model_class
Gsa18f::Procurement
end
def permitted_params
Gsa18f::Procurement.permitted_params(params, @client_data_instance)
end
end
end
|
module PrintCreditHeader
extend ActiveSupport::Concern
include PrintDocumentStyle
def credit_header(pdf)
pdf.bounding_box([0.mm, 280.mm], :width => 190.mm, :height => 15.mm) do
pdf.text "Credit Note", {:size => 24, :align => :right, :font_style => :bold}
end
end
end
|
require 'spec_helper'
require 'poms/api/uris/schedule'
module Poms
module Api
module Uris
RSpec.describe Schedule do
let(:base_uri) { Addressable::URI.parse('https://rs.poms.omroep.nl') }
describe '.now' do
subject { described_class.now(base_uri, 'OPVO') }
it 'returns ... |
class PurchaseSerializer < ActiveModel::Serializer
attributes :id, :quantity, :total_price, :buyer_score, :seller_score, :was_shipped, :was_delivered, :product, :created_at, :updated_at#,:origin_id, :product_id
# has_one :product
has_one :seller #change some belongs to for has_one
has_one :buyer
belon... |
class Order
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Attributes::Dynamic
field :number, type: Integer, default: 0
field :count_items, type: Integer, default: 0
field :session_id, type: String, default: ''
field :email, type: String, default: ''
field :name, type: String, d... |
module Puppet::Parser::Functions
newfunction(:is_oracle_patch_installed, :type => :rvalue, :doc => <<-EOS
Takes 2 parameters, the oracle_home and the patch_id.
Returns true if the patch_id is installed in the oracle_home.
EOS
) do |args|
raise(Puppet::ParseError, 'is_oracle_patch_installed(): Wro... |
require 'rake'
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
def run_in_dummy_app(command)
success = system("cd spec/dummy && #{command}")
raise "#{command} failed" unless success
end
task default: :ci
task test: :spec
desc 'Run all tests for CI'
task ci: %w(db:setu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.