text stringlengths 10 2.61M |
|---|
# -*- encoding : utf-8 -*-
class DissertationRepresent < ActiveRecord::Base
belongs_to :scientific_work
attr_accessible :report, :scientific_work_id, :time_end, :time_start
end
|
require('minitest/autorun')
require('minitest/rg')
require_relative("../dice.rb")
class TestDice < MiniTest::Test
def setup
@dice = Dice.new()
end
def test_roll_dice
1000.times do
accepted_values = (1..6).to_a()
@dice.roll_dice()
result = @dice.current_number
assert_equal(true,... |
class Comment < ApplicationRecord
belongs_to :student
belongs_to :rehearsal
validates :content, presence: true
end
|
require 'rails_helper'
RSpec.describe "pessoa2s/show", type: :view do
before(:each) do
@pessoa2 = assign(:pessoa2, Pessoa2.create!(
:nome => "Nome",
:telefone => "Telefone"
))
end
it "renders attributes in <p>" do
render
expect(rendered).to match(/Nome/)
expect(rendered).to match... |
# == Schema Information
#
# Table name: projects
#
# id :integer not null, primary key
# name :string(255)
# description :text
# created_at :datetime
# updated_at :datetime
# organization_id :integer
#
class Project < ActiveRecord::Base
has_many :comments
belon... |
class FilmsController < ApplicationController
before_action :customer_logged_in
def index
@customer = Customer.find(session[:customer_id])
@rented_films = @customer.films.sorted
end
def show
end
end
|
Qiankun::Admin.controllers :organizes do
get :index do
@title = "Organizes"
@organizes = Organize.all
render 'organizes/index'
end
get :new do
@title = pat(:new_title, :model => 'organize')
@organize = Organize.new
render 'organizes/new'
end
post :create do
@organize = Organize.n... |
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = "resumerb"
s.version = "0.2.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygem... |
require 'easy_diff'
require 'mongoid/compatibility'
require 'mongoid/history/attributes/base'
require 'mongoid/history/attributes/create'
require 'mongoid/history/attributes/update'
require 'mongoid/history/attributes/destroy'
require 'mongoid/history/options'
require 'mongoid/history/version'
require 'mongoid/history/... |
require_relative 'test_helper'
require 'tempfile'
require 'tmpdir'
require 'pathname'
_MockTemplate = Class.new(Tilt::Template) do
def prepare
end
end
describe "tilt/template" do
it "needs a file or block" do
assert_raises(ArgumentError) { Tilt::Template.new }
end
it "initializing with a file" do
i... |
class CreateAdmins < ActiveRecord::Migration[5.0]
def change
create_table :admins do |t|
t.string :username, comment: '昵称,用户名'
t.string :phone, comment: '手机号'
t.string :password_digest, comment: '密码'
t.integer :status, default: 0, comment: '用户状态:0:正常,1:禁用'
t.string :name, comment: '姓... |
# encoding: UTF-8
module API
module V1
class PresentationSlides < API::V1::Base
helpers API::Helpers::V1::PresentationSlidesHelpers
helpers API::Helpers::V1::SharedParamsHelpers
helpers API::Helpers::V1::SharedServiceActionsHelpers
before do
authenticate_user
end
na... |
require 'active_job/queue_adapters/active_elastic_job_adapter'
RSpec.configure do |config|
config.before(:suite) do
ActiveJob::QueueAdapters::ActiveElasticJobAdapter.send(:instance_variable_set, :@aws_credentials, Aws::SharedCredentials.new)
end
config.after(:suite) do
ActiveJob::QueueAdapters::ActiveEl... |
# frozen_string_literal: true
RSpec.describe Dry::Logic::Rule do
subject(:rule) { described_class.build(predicate, **options) }
let(:predicate) { -> { true } }
let(:options) { {} }
let(:schema) do
Class.new do
define_method(:class, Kernel.instance_method(:class))
def respond_to_missing?(m, *... |
require 'rails_helper'
RSpec.describe ClaimantsDetail, type: :model do
let(:populated_claimant_detail) {
described_class.new(
employment_start: '01/01/2017', employment_end: '31/12/2017', claimants_name: 'Jane Doe',
agree_with_early_conciliation_details: false, disagree_conciliation_reason: 'lorem i... |
require 'chef/resource/execute'
class ::Chef
class Resource
# Execute command on even why-run mode
#
# HOW TO USE:
#
# whyrun_safe_execute "#{name}" do
# command "#{command}"
# end
#
# OPTIONS:
#
# Other options are same with `execute` resource.
# See htt... |
require "rails_helper"
RSpec.describe Movie, type: :model do
#tests go here
context 'review validations' do
it "review is valid when all attributes are present" do
expect(Review.create(movie_id: 1, content: "content", scare_rating: 2, user_id: 1))
end
end
end |
# Write a method that can rotate the last n digits of a number.
# Note that rotating just 1 digit results in the original number being returned.
# You may use the rotate_array method from the previous exercise if you want. (Recommended!)
# You may assume that n is always a positive integer.
def rotate_array(arr)
rot... |
# frozen_string_literal: true
module Customerio
class IdentifyUsersJob < ApplicationJob
queue_as :customerio
def perform
User.select(:id).order(:id).paged_each do |user|
Customerio::IdentifyUserJob.perform_later(user_id: user.id)
end
end
end
end
|
# frozen_string_literal: true
require 'sample_agent_test_configuration'
require 'utils/agent_runner'
describe TrapRepeatIfDoneAgent do
include_context 'use data_builder'
let(:runner) { Utils::AgentRunner.new }
before(:example) do
runner.register_agent_file(
'sample_agents/src/trap_repeat_if_done.... |
# 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 'net/http'
require 'json'
require 'uri'
require 'optparse'
require 'logger'
class AccessionFixer
def initialize(opts, log)
@backend_url = URI.parse(opts[:backend_url])
@username = opts[:username]
@password = opts[:password]
@commit = opts[:commit] || false
@session = nil
@subject_tit... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
ENV['VAGRANT_DEFAULT_PROVIDER'] = 'docker'
ENV['VAGRANT_NO_PARALLEL'] = 'yes'
$ssh_script = <<-SCRIPT
cat /home/vagrant/.ssh/id_rsa.pub >> /home/vagrant/.ssh/authorized_keys
SCRIPT
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
###... |
class ClientsController < ApplicationController
def index
@clients = Client.all
end
def new
@client = Client.new
end
def create
@client = Client.new(client_params)
@account = @client.build_account(client_id: @client.id, balance: 0.00)
if @client.save && @account.save
#ClientMailer.account_activ... |
class CoursesController < ApplicationController
before_action :authenticate_user!
def index
load_courses
end
def new
build_course
end
def create
build_course
save_course or render(:new)
end
private
def load_course
@course ||= course_scope.find(params[:id])
end
def l... |
require "ddoc/version"
require "ddoc/watcher"
require "ddoc/documenter"
require "ddoc/formatter"
module Ddoc
def self.document!(klass, out_file_name = nil)
formatter = proc { |*args| Ddoc::Formatter.new(*args).to_s }
file_names = caller.map { |file_and_caller| file_and_caller.split(':').first }
in_file... |
# == Schema Information
#
# Table name: albums
#
# id :bigint(8) not null, primary key
# image_content_type :string
# image_file_name :string
# image_file_size :bigint(8)
# image_updated_at :datetime
# created_at :datetime not null
# updated_at :datetime ... |
require 'singleton'
require 'rubygems'
require 'addressable/uri'
class TLD
MAP = {
:ac => 'sh',
:uk => 'gb',
:su => 'ru',
:tp => 'tl',
:yu => 'rs'
}
include Singleton
class UnknownTldError < StandardError; end
def to_s
tld
end
def tld
self.class.tld
end
def name
s... |
class TransmissionsController < ApplicationController
before_action :set_transmission, only: [:show, :edit, :update, :destroy]
def last
render json: Transmission.order('created_at').last
end
def create_random
render json: Transmission.create_random
end
# GET /transmissions
# GET /transmissions.... |
require 'rails_helper'
RSpec.describe CurriculumVitae, type: :model do
it_behaves_like 'it has a valid factory', :curriculum_vitae
subject { CurriculumVitae.new }
describe '#file' do
it 'must be present' do
subject.file = nil
expect(subject.save).to be_falsey
file = File.join(Rails.root,... |
require 'spec_helper'
describe "board_majors/edit" do
before(:each) do
@board_major = assign(:board_major, stub_model(BoardMajor))
end
it "renders the edit board_major form" do
render
# Run the generator again with the --webrat flag if you want to use webrat matchers
assert_select "form[action=... |
require 'spec_helper'
describe Praxis::MultipartParser do
let(:form) do
form_data = MIME::Multipart::FormData.new
destination_path = MIME::Text.new('/etc/defaults')
form_data.add destination_path, 'destination_path'
form_data
end
let(:headers) { form.headers.headers }
let(:body) { form.body... |
require(__FILE__.split('art_pazar/').first << '/art_pazar/lib/lib_loader.rb')
describe "In integration CartController" do
let(:cart_controller) { CartController.new }
context "when creating" do
it "has one product" do
expect(cart_controller.products_count).to eq 1
end
xit "raises error if no pr... |
module Enjoy::News
module Models
module Mongoid
module Image
extend ActiveSupport::Concern
if Enjoy::News.config.gallery_support
included do
belongs_to :enjoy_gallery_imagable, class_name: 'Enjoy::News::News'
validates_lengths_from_database only: [:name]
... |
require File.dirname(__FILE__) + '/../test_helper'
class RoleTest < Test::Unit::TestCase
fixtures :roles, :users, :groups, :roles_users, :user_registrations, :groups_users, :groups_roles
def setup
end
#
# The tests
#
def test_roles_from_fixtures_should_be_correct
fixture_roles = [ @gods_role, @maj... |
require 'test/unit'
require 'contracts/hipchat-message'
class TestHipchatMessage < Test::Unit::TestCase
def build_test_json(messageText)
return <<JSON
{
"event": "event",
"item": {
"message": {
"date": "date",
"from": {
"id": "userId",
"mention_name": "@JRandomUser",
... |
class Event < ApplicationRecord
self.table_name = 'rennen'
self.primary_keys = 'Regatta_ID', 'Rennen'
alias_attribute :number, 'Rennen'
alias_attribute :name_short, 'NameK'
alias_attribute :name_de, 'NameD'
alias_attribute :name_en, 'NameE'
alias_attribute :start_measuring_point_number, 'StartMesspunktN... |
class Dessert
## Worked with Luke Woodruff
@name = nil
@calories = nil
attr_accessor :name, :calories
def initialize(name, calories)
@name = name
@calories = calories
end
def healthy?
if @calories < 200 then true
else false; end
end
def delicious?
return true
end
end
class JellyB... |
class PickAPointSequence < ActiveRecord::Base
hobo_model # Don't put anything above this
fields do
initial_prompt :text
correct_condition :string
give_up_prompt :text
correct_prompt :text
timestamps
end
has_one :page_sequence, :as => :sequence, :dependent => :destroy
has_one :page, :thr... |
class ScenarioVariable < Variable
belongs_to :scenario
validates_presence_of :scenario
end
|
class Slide < ActiveRecord::Base
attr_reader :comment
has_attached_file :picture, styles: { return_medium: "1280x3000>", medium: "640x3000>" }, :default_url => "/images/:style/missing.png"
validates_attachment_content_type :picture, content_type: /\Aimage\/.*\Z/
validates_attachment_file_name :picture, matches... |
Pod::Spec.new do |spec|
spec.swift_versions = ['5.0']
spec.name = 'FSwift'
spec.version = '3.0.0'
spec.license = { :type => 'BSD' }
spec.homepage = 'https://github.com/kperson/FSwift'
spec.authors = 'Kelton Person'
spec.summary = 'functional programming library for Swift'
... |
class League < ActiveRecord::Base
#--------------------------------#
# Connections
#--------------------------------#
has_many :soccer_fields
has_many :games
belongs_to :user
belongs_to :game_type
belongs_to :league_type
belongs_to :city
has_many :scores
has_many :teams, :through => :scores
has_many :league... |
require 'fustigit'
require 'vanagon/component/source/http'
require 'vanagon/component/source/git'
require 'vanagon/component/source/local'
class Vanagon
class Component
class Source
SUPPORTED_PROTOCOLS = %w[file http https git].freeze
class << self
# Basic factory to hand back the correct {V... |
class DepartmentsStoresController < ApplicationController
before_action :set_departments_store, only: [:show, :edit, :update, :destroy]
# GET /departments_stores
# GET /departments_stores.json
def index
@departments_stores = DepartmentsStore.all
end
# GET /departments_stores/1
# GET /departments_sto... |
# frozen_string_literal: true
module Vacuum
VERSION = '3.2.0'
end
|
class AnimalAssociationsController < ApplicationController
before_action :set_animal, only: [:create, :destroy]
before_action :set_animal_association, only: [:destroy, :update]
before_filter :authenticate_user!
authorize_resource
def create
@animal_association = AnimalAssociation.find_or_initialize_by(... |
class Book < ApplicationRecord
has_one_attached :photo
include PgSearch::Model
pg_search_scope :search_by_full_name, against: [:title, :author]
end
|
class RemovePriceFromBooks < ActiveRecord::Migration
def change
remove_column :books, :price, :decimal, precision: 10, scale: 2
end
end
|
# frozen_string_literal: true
class PostPublisherJob < ApplicationJob
queue_as :posts
def perform(post)
unless post.published?
campaign = Campaign.find(post.node.campaign_id)
FacebookManager.publish(post.body, post.content, campaign.token, post.id)
end
end
end
|
require_relative '../../refinements/string'
using StringRefinements
module BankStatements
module HashCategories
CATEGORIES =
{
'Supermarket' => [
'Sainsbury', 'Tesco', 'Asda', 'Morrison', 'Waitrose', 'Aldi', 'Lidl',
'M and S'.when_matches_with('Marks/Spencer', 'M and S Simply Food', '... |
class CreateExerciseMuscles < ActiveRecord::Migration
def change
create_table :exercise_muscles do |t|
t.string :type
t.references :exercise, index: true, foreign_key: true
t.references :muscle, index: true, foreign_key: true
t.timestamps null: false
end
end
end
|
module ApplicationHelper
# Check to see if alerts are present.
def alerts_present?
notice.present? || alert.present?
end
def alert_banner_class
if notice.present?
"notice"
elsif alert.present?
"alert"
else
"unknown"
end
end
# Build titles for pages and provide a sane... |
# app.rb
require 'sinatra'
require 'sinatra/content_for'
require 'holidapi'
class MyWebApp < Sinatra::Base
helpers Sinatra::ContentFor
get '/' do
params['country'] ||= 'us'
params['year'] ||= '2015'
params['month'] ||= '1'
@holidays = HolidApi.get(country: params['country'], year: params['year'], m... |
require 'rails_helper'
RSpec.describe "christmasevenings/index", type: :view do
before(:each) do
assign(:christmasevenings, [
Christmasevening.create!(),
Christmasevening.create!()
])
end
it "renders a list of christmasevenings" do
render
end
end
|
# == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# username :string(255)
# created_at :datetime
# updated_at :datetime
#
require 'spec_helper'
describe User do
before { @user = User.new(username: "exampleuser",
password: "foobar",... |
class DateTimeProperty < PropertyBase
def value
super.is_a?(String) ? typecast(super) : super
end
def typecast(value)
value.blank? ? nil : DateTime.parse(value)
end
def self.exteriors
{ "日期选择器" => "date_picker", "传统模式" => "date_select" }
end
end
|
require 'game'
describe Game do
let(:player1) { double(:player1, name: 'Johnny Cash') }
let(:player2) { double(:player2, name: 'Computer') }
subject(:game) { described_class.new(player1,player2) }
before do
allow(Kernel).to receive(:rand) {10}
allow(player2).to receive(:receive_damage)
allow(playe... |
class AddProjectPicturesToProject < ActiveRecord::Migration
def change
add_column :projects, :project_pictures, :text
end
end
|
ActiveAdmin.register Certificate do
menu label: "Сертификаты", priority: 2, parent: "Персонал", parent_priority: 6
permit_params :doctor_id, :image_url
actions :all, except: [:show]
filter :doctor_name, as: :select,
collection: -> { Doctor.all },
label: 'Доктор'
form do |f|
f.inputs 'Доктор... |
require 'form-focus-rails/version'
module Form
module Focus
module Rails
class Engine < ::Rails::Engine
initializer 'form-focus-rails' do
end
end
end
end
end
|
class Spiral
def perfect_square?(num)
sqrt = Math.sqrt(num)
sqrt == sqrt.to_i
end
# The center of the 2D array, zero offset. For even height/width arrays,
# center is the cell to the lower-left of the center vertex.
def center_coords(num)
sqrt = Math.sqrt(num)
[
((sqrt/2.0)-0.5).floor... |
# frozen_string_literal: true
module Senrigan
class CLI
def initialize(argv)
@argv = argv.clone
end
def run!
clear_terminal
show_header
formatter = Senrigan::Formatter.new
adapter = Senrigan::Adapter.new
adapter.on do |entity|
formatter.format_print(entity)
... |
class RemoveDeletedColumnFromUsers < ActiveRecord::Migration
def change
remove_column :users, :deleted, :boolean, :default => false
end
end
|
ActiveAdmin.register Feedback do
# See permitted parameters documentation:
# https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters
#
# permit_params :list, :of, :attributes, :on, :model
#
# or
#
permit_params do
permitted = [:name, :email, :description]
... |
require 'calabash-android'
require 'calabash-android/operations'
class BaseClass
include Calabash::Android::Operations
def initialize(driver)
@driver = driver
end
def method_missing(sym, *args, &block)
@driver.send sym, *args, &block
end
def field(el_type)
"#{el_type}"
end
... |
require 'poker'
require 'rspec'
require_relative 'spec_helper'
describe Card do
let(:card_test) { Card.new(:H, 14) }
describe '#Initialize' do
it 'initializes with suit and a value' do
expect(card_test.suit).to eq(:H)
expect(card_test.value).to eq(14)
end
end
e... |
# $Id: wddx_packet.rb 94 2006-12-24 13:05:36Z stefan $
# Created by Stefan Saasen.
# Copyright (c) 2006. All rights reserved.
module WDDX
PACKET_VERSION = 1.0
# Resembles a WddxPacket
#
# A WddxPacket has a single data field and a comment (a string)
#
# = Usage
# require 'rubygems' ... |
# frozen_string_literal: true
module Views::Videos
class View < BaseOperation
def call(user:, video:)
::VideoView.create(user: user, video: video) unless video.viewed_by?(user.id)
end
end
end
|
require 'spec_helper'
describe Team do
before(:each) do
@attr = { :name => "Austin Aztex", :address1 => "123 Main St.",
:address2 => "Apt A", :city => "Austin", :state => "TX",
:zip => "78704", :phone => "", :website => "http://foo.com",
:email => "test@foo.com", :countr... |
require( 'pg')
require_relative('../db/sql_runner')
class Team
attr_reader(:id, :team_name, :location)
def initialize(options)
@id = options['id'].to_i
@team_name = options['team_name']
@location = options['location']
end
def save()
sql = "INSERT INTO teams ( team_name,... |
require 'spec_helper'
describe 'App' do
before(:each) do
@nombre_plan = 'PlanJuventud'
@costo_plan = 100
@limite_visita_plan = 3
@cobertura_medicamentos = 80
@copago = 3
@edad_minima = 10
@edad_maxima = 60
@cantidad_hijos = 0
@conyuge = false
data = { 'nombre' => @nombre_plan,... |
# frozen_string_literal: true
require 'rails/generators'
require "rails/generators/named_base"
require_relative "core"
module Graphql
module Generators
# @example Generate a `GraphQL::Batch` loader by name.
# rails g graphql:loader RecordLoader
class LoaderGenerator < Rails::Generators::NamedBase
... |
class ReportEmailer < ActionMailer::Base
default from: ENV['EPA_EMAIL']
def send_report_uploaded_email(shopper_report)
@shopper_report = shopper_report
mail to: ENV['EPA_EMAIL_LIST'], subject: 'Shopper Report Uploaded'
end
end |
class MuscleGroup < ActiveRecord::Base
has_many :target_muscle_groups
has_many :exercises, :through => :target_muscle_group
has_many :muscles, :dependent => :destroy
end
|
#!/usr/bin/env ruby
# encoding: utf-8
require "bunny"
con = Bunny.new
con.start
ch = con.create_channel
x = ch.topic("topic_logs")
# When rabbitmq doesn't receive any name for the queue, it generates one for
# you
#
q = ch.queue("", :durable => true)
# Attach the queue to an exchange
ARGV.each do | severity |
q... |
CarrierWave.configure do |config|
config.fog_provider = 'fog/aws'
config.fog_credentials = {
:provider => 'AWS',
:aws_access_key_id => ENV['AWS_ACCESS_KEY_ID'],
:aws_secret_access_key => ENV['AWS_SECRET_ACCESS_KEY'],
:region => 'eu-west-1'
}
config.fog_directo... |
class ImageFile < ApplicationRecord
belongs_to :blob, dependent: :destroy
belongs_to :efemeride
validates :filename, presence: false, length: {minimum: 1, maximum: 255}
validates :content_type, presence: false, length: {minimum: 1, maximum: 255}
# don't forget to take .to_blob from the following
def get_... |
require 'spec_helper'
describe Api::V1::PublishersController do
describe 'with no publishers' do
before :each do
Publisher.delete_all
end
it 'creates an publisher on create' do
expect {
make_request :post, '/publishers', {:publisher => (new_publisher = FactoryGirl.build(:publisher))... |
class Student
@@nos_of_students=0
@@marks1=0
@@marks2=0
@@marks3=0
@@avg=0
@@perc=0
attr_accessor :name,:age,:marks1,:marks2,:mark3
attr_accessor :name
def initialize
@name= name
@@nos_of_students +=1
end
def user_input
puts "Enter name of stud... |
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Ch... |
class Antibody < ActiveRecord::Base
belongs_to :people
end |
class Tweet
include MongoMapper::Document
set_collection_name "tweets_to_test_against"
key :identifier, Integer
key :fullText, String
key :category, String
end
|
require_relative 'test_helper'
describe "workspace class" do
before do
VCR.use_cassette("workspace") do
@workspace = Slack::Workspace.new
end
end
describe "initialize" do
it "will load a list of all users in the server" do
VCR.use_cassette("workspace") do
expect(@workspace.users... |
module SpriteEdit
class EditingState < Chingu::GameState
ACTIVE_LAYER = Gosu::Color::GREEN
INACTIVE_LAYER = Gosu::Color::BLUE
attr_reader :active_frame, :parts, :session, :animation
def setup
abort unless @options[:file]
@file = @options[:file]
@dat = YAML.load_file File.expand_path(@file)
@parts, @ani... |
require "erb"
require "fpm/namespace"
require "fpm/package"
require "fpm/errors"
class FPM::Target::Deb < FPM::Package
def self.flags(opts, settings)
settings.target[:deb] = "deb"
opts.on("--ignore-iteration-in-dependencies",
"For = dependencies, allow iterations on the specified version. Defa... |
json.array!(@telefone_clientes) do |telefone_cliente|
json.extract! telefone_cliente, :id, :ddd, :telefone, :Cliente_id
json.url telefone_cliente_url(telefone_cliente, format: :json)
end
|
class CreateBatches < ActiveRecord::Migration
def self.up
create_table :batches do |t|
t.string :batch_type
t.string :assigned_to
t.string :state
t.integer :item_count
t.integer :closed_count
t.date :expires_on
t.timestamps
end
end
def self.down
drop_table :b... |
require 'Account'
require 'pry'
describe 'Account' do
subject(:acc) { Account.new }
it 'should be an object' do
expect(acc).to be_a(Account)
end
describe '#create_transaction' do
it 'should be able to add a transaction object to the account' do
acc.create_transaction(amount: 100)
expect(a... |
class DiigoSidebar < Sidebar
display_name "Diigo"
description 'Bookmarks from <a href="http://diigo.com">Diigo</a> social bookmarking service'
setting :feed, nil, :label => 'Diigo Username'
setting :count, 10, :label => 'Items Limit'
setting :groupdate, false, :input_type => :checkbox, :label => 'Group lin... |
class WelcomeController < ApplicationController
respond_to :html, :js
def index
@headlines = Headline.order('created_at desc').first(10)
end
end
|
class HtmlFile
attr_reader :hash, :fileHtml, :obits
def initialize(obits)
@obits = obits
File.delete("obit_results.html") if File.exists?("obit_results.html")
@fileHtml = File.new("obit_results.html", "w+")
end
def create
before_table_rows
obits.each { |obit| table_row(obit)}
after_tabl... |
require './test/test_helper'
require './test/payload_samples.rb'
class ViewEventIndex < FeatureTest
include Rack::Test::Methods
def setup
post '/sources', PayloadSamples.register_users
PayloadSamples.initial_payloads.each do |payload|
post '/sources/jumpstartlab/data', payload
end
end
def t... |
require 'test_helper'
class PlayerMatchesControllerTest < ActionDispatch::IntegrationTest
setup do
@player_match = player_matches(:one)
end
test "should get index" do
get player_matches_url
assert_response :success
end
test "should get new" do
get new_player_match_url
assert_response :s... |
require 'rails_helper'
RSpec.describe 'Admin creates a new sanctuary', type: :feature do
let(:admin) { create(:user, :admin) }
before do
login_as(admin)
end
scenario 'creating a new sanctuary' do
location_count = Sanctuary.count
visit new_admin_sanctuary_path
fill_in 'Name', with: FFaker::Na... |
# == GitHost role
#
# Provide a shortcut to Gitlab::Gitolite instance
#
# Used by Project, UsersProject
#
module GitHost
def git_host
Gitlab::Gitolite.new
end
end
|
class CreateNotificationNotificationPreferences < ActiveRecord::Migration
def change
create_table :notification_notification_preferences do |t|
t.references :user
t.string :model_name
t.string :action
t.string :handle
t.boolean :active
t.timestamps
end
add_index :notif... |
class EnfoqueMateriaController < ApplicationController
before_action :set_enfoque_materium, only: [:show, :edit, :update, :destroy]
# GET /enfoque_materia
# GET /enfoque_materia.json
def index
@enfoque_materia = EnfoqueMaterium.all
end
# GET /enfoque_materia/1
# GET /enfoque_materia/1.json
def sho... |
class RobotAlreadyDeadError < StandardError
def initialize(robot)
super("robot is already dead and cannot be healed.")
end
end
class UnattackableEnemyError < StandardError
def initialize(robo)
super("Can't attack a non-robot!")
end
end |
# frozen_string_literal: true
module Samples
class Company
REQUIRED_SKILLS = %i(ruby javascript rails html css).freeze
attr_reader :name
def initialize(name, skills)
@name = name
@skills = skills
end
def recieve_application(application)
Feedback.new(self, application)
e... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.