text stringlengths 10 2.61M |
|---|
require 'spec_helper'
describe SearchController do
render_views
describe "GET 'index'" do
it "should be successful" do
get :index
response.should be_success
end
it "should display the correct beer" do
beer = Factory(:beer)
get :index, :search => { :name_contains => beer.name }... |
class AddDay1Event1ToWeddings < ActiveRecord::Migration
def change
add_column :weddings, :day1_event1, :string
end
end
|
FactoryGirl.define do
factory :batch do
factory :batch_with_sales do
transient do
sales_count 5
end
after(:create) do |batch, evaluator|
create_list(:sale, evaluator.sales_count, batch: batch)
end
end
end
end
|
class RemoveColumnsInTrips < ActiveRecord::Migration[6.1]
def change
remove_column :trips, :price
remove_column :trips, :activities
end
end
|
require 'rails_helper'
RSpec.describe User, type: :model do
it 'name should be present' do
user = User.new(name: nil, last_name: "Vecino")
expect(user).to_not be_valid
end
it 'last name should be present' do
user = User.new(name: "Andrea", last_name: nil)
expect(user).to_not be_valid
end
l... |
module CloudstackSpec
module Resource
##
#
# networks tiers inside VPC
#
# Arguments:
# name: (string, default='rspec-vpc-tier')
# offering: (string, default='DefaultIsolatedNetworkOfferingForVpcNetworks')
# acl: (string, default='default_allow')
# gateway: (strin... |
class MessageThread < ActiveRecord::Base
validates_presence_of :subject,:creator_id, :message=>"#{t('subject_cant_blank')}"
validates_length_of :subject, :maximum => 100, :message=>"#{t('subject_must_be_below_100')}"
xss_terminate
belongs_to :creator, :class_name => 'User'
has_many :messages, :dependent=>:des... |
class AddIndexesToUserRelationships < ActiveRecord::Migration
def change
add_index :user_relationships, :follower_id
add_index :user_relationships, :followed_id
add_index :user_relationships, [:follower_id, :followed_id], unique: true
end
end
|
class AddColumnStatusOnRegularMessage < ActiveRecord::Migration
def change
add_column :regular_messages, :status, :string, :default => 'send_on_application'
end
end
|
admin_policies = [
'AdministratorAccess',
'SystemAdministrator',
'CloudFormationStackSetsOrgAdminServiceRolePolicy'
] + input('admin-policies', value: [])
control 'EC2AdminInstanceRoleRuby' do
impact 'high'
title "Ensure no EC2 instances have admin roles."
tag severity: 'High'
aws_ec2_instances.instance... |
require 'rails_helper'
describe 'guests can log into site' do
scenario 'guest fills out log in info and is taken to user page' do
user = User.create!(name: 'sto', email: 'sto@sto.com', password: 'sto')
visit root_path
click_on 'Log in'
expect(current_path).to eq(login_path)
fill_in 'session[e... |
# frozen_string_literal: true
RSpec.describe 'Sockets Authenticate' do
resource 'Sockets authenticate endpoint' do
route '/api/v1/sockets/auth', 'Sockets authenticate' do
before(:each) do
header 'Content-Type', 'application/json'
end
post 'Sockets Authenticate' do
parameter :so... |
require_relative('../db/sql_runner.rb')
require_relative('./city.rb')
class Country
attr_reader :name, :visited, :description, :id
def initialize(options)
@name = options['name']
@visited = options['visited']
@description = options['description']
@id = options['id'].to_i
end
def save()
sq... |
class CreatePrinters < ActiveRecord::Migration
# 打印机 printer
#
#打印方式 printer_method
#打印机类型 printer_type
#是否为彩色 color
#接口 interface
#是否有网络模块 net_module
#支持双面打印 duplex_printing
def self.up
create_table :printers do |t|
t.string "printer_method"
t.string "printer_type"
t.string ... |
class AddTimeGetLicenseToDrivers < ActiveRecord::Migration
def change
add_column :drivers, :time_get_license, :string
end
end
|
class PledgesController < ApplicationController
before_action :authenticate_donor!
before_action :set_donor, only: [:new, :create, :edit, :update, :destroy]
def manage_pledges
@donor = Donor.find(params[:id])
@pledges = Pledge.where(donor_id: @donor.id)
end
def index
@donor = Donor.find... |
require 'byebug'
class User < ActiveRecord::Base
has_many(
:polls,
primary_key: :id,
foreign_key: :user_id,
class_name: "Poll"
)
has_many(
:responses,
primary_key: :id,
foreign_key: :user_id,
class_name: "Response"
)
validates :user_name, :presence => true
def completed_p... |
#
# Ruby For Kids Projects 11: Tower of Hanoi
# Programmed By: Chris Haupt
# Towers of Hanoi puzzle
#
# to run the program use:
# run.bat
#
require 'gosu'
require_relative 'game'
class Tower < Gosu::Window
def initialize
super(800, 600, false)
self.caption = "Tower of Hanoi"
@game = Game... |
class CreateBills < ActiveRecord::Migration[5.1]
def change
create_table :bills do |t|
t.float :amount_due
t.string :due_date
t.boolean :overdue?, default: false
t.boolean :paid?, default: false
t.string :payment_method
t.belongs_to :tenant
t.timestamps
end
end
end
|
#==============================================================================#
# ** IEX(Icy Engine Xelion) - Scene Shop - CMV(Cosmetic Version) ALT
#------------------------------------------------------------------------------#
# ** Created by : IceDragon (http://www.rpgmakervx.net/)
# ** Script-Status : ReWrite ... |
module SpyFu
class Response
attr_reader :parsed_response, :code
def initialize(raw_response)
@parsed_response = ActiveSupport::JSON.decode(raw_response.body.gsub('-2147483648', '""'))
@code = raw_response.code
end
def call
return parsed_response if success?
if parsed_respons... |
require "spec_helper"
RSpec.describe "Day 17: Spinlock" do
let(:runner) { Runner.new("2017/17") }
let(:input) { "3" }
describe "Part One" do
let(:solution) { runner.execute!(input, part: 1) }
it "determines the value after the last value written" do
expect(solution).to eq(638)
end
end
end
|
class AzoogleImport
require 'csv'
require 'yaml'
def initialize
@backend = Adbackend.find_by_name("azoogle")
raise "Ad backend not found! => #{name}" unless @backend
@page_names = Adpage.find(:all).collect{|ap| [ap.name, ap]}
end
def import!(in_csv_filename=nil,in_mapping_filename=nil)
r... |
class SchedulesController < AuthenticatedController
def initialize
super
@show_breadcrum = true
add_breadcrumb "Reminders", :schedules_path
end
# GET /schedules
# GET /schedules.xml
def index
@at_least_one_schedule_is_paused = !Schedule.where(:user_id => current_user.id, :paused => true).emp... |
class RAgglomerativeClusterer
def initialize(items, simfunc)
@dendogram = []
@simfunc = simfunc
createDendogram items
end
def createDendogram(items)
items.each { |e| @dendogram << [e] }
cluster1 = nil
cluster2 = nil
while @dendogram.size > 2
puts @dendogram.size
max = -1.0
newCluster = [nil,... |
require './tridiagonal_matrix'
require 'test/unit'
class MatrixFactory
include Test::Unit::Assertions
def create_dict(rows)
dict = {}
column_count = rows[0].length
rows.each_with_index do |row, row_idx|
assert(row.length == column_count, "Row length mismatch")
... |
# Copyright 2015 Ride Connection
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... |
class EARMMS::MembershipAdminBranchMeetingsController < EARMMS::MembershipAdminController
get '/:branchid' do |branchid|
next halt 404 unless logged_in?
next halt 404 unless has_role? 'admin:branch'
@branch = EARMMS::Branch[branchid.to_i]
next halt 404 unless @branch
@branch_name = @branch.decryp... |
Then /^I see Amex payment option$/ do
@wait.until {@amex_checkout.amexBtn?}
end
Then /^I should not see Amex payment option$/ do
@wait.until {!@amex_checkout.amexBtn?}
end
And /^I tap Amex EXPRESS checkout$/ do
@wait.until {@amex_checkout.amexBtn_element.visible?}
sleep 1
@amex_checkout.amexBtn
sleep 3
en... |
# 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... |
# == Route Map
#
# Prefix Verb URI Pattern Controller#Action
# new_user_session GET /users/sign_in(.:format) devise/sessions#new
# user_session POST /users/sign_in(.:format) devise/sessions#create
# destroy_user_session DELETE /users/sign_o... |
require 'test_helper'
class CrimeWitnessesControllerTest < ActionDispatch::IntegrationTest
setup do
@crime_witness = crime_witnesses(:one)
end
test "should get index" do
get crime_witnesses_url
assert_response :success
end
test "should get new" do
get new_crime_witness_url
assert_respon... |
require "test_helper"
require "reqrep/test/response_lint"
class HTTP1ResponseTest < Minitest::Test
include ReqRep::Test::ResponseLint
def response
@response ||= Jaguar::HTTP1::Response.new
end
end
|
#!/usr/bin/env ruby
#!/usr/bin/ruby -rubygems
# Geek: Henry J. Escobar
# Contact: henry.escobar@gmail.com
# GIT: https://github.com/HenryEscobar/printJson
#
# Purpose: Print a json file in a nice format
# Bugs
#
# Notes: Just a quick simple util anyone should be able to write.
#
require "json"
require "rubygems"
if (... |
# => Author:: Valentin, DanAurea
# => Version:: 0.1
# => Copyright:: © 2016
# => License:: Distributes under the same terms as Ruby
#
##
## Classe permettant de créer un contrôleur pour la vue FenetrePseudo
##
class PseudoControleur < Controller
##
## Initialize
##
def initialize()
... |
describe 'Menu' do
describe "The Menu Page" do
it "should have the phrase 'Menu Item 9'" do
visit '/menus/menu1'
page.should have_content 'Menu Item 9'
end
end
end
|
class AddAttributesToLevelDescription < ActiveRecord::Migration
def change
add_column :level_descriptions, :main_competency, :text
add_column :level_descriptions, :european_benchmark, :text
add_column :level_descriptions, :professional_profile, :text
add_column :level_descriptions, :professional_envir... |
ActiveAdmin.register Article do
# See permitted parameters documentation:
# https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters
#
# Uncomment all parameters which should be permitted for assignment
#
permit_params :title, :description, :topic... |
class SubscriptionInvoicePDF < Prawn::Document
CONSTANTS = {
table_head_color: 'dddddd',
notice_color: '3399cc',
notice_font_size: 12,
heading_color: 'f4733d',
table_row_color: 'ffffff',
table_font_size: 16,
head_font_size: 16
}.freeze
attr_reader :constants
def initialize(subscri... |
require 'rails_helper'
RSpec.describe "paragraphs/show", type: :view do
before(:each) do
@paragraph = assign(:paragraph, Paragraph.create!(
:name => "Name",
:working_article => nil,
:order => 2,
:para_text => "MyText",
:tokens => "MyText"
))
end
it "renders attributes in <p... |
class CreateDocs < ActiveRecord::Migration
def self.up
create_table :docs do |t|
t.string :path, :null => false, :default => ""
t.string :folder, :null => false, :default => ""
t.string :title, :null => false, :default => ""
t.string :key, :null => false, :default => ""
t.string :sta... |
class CampaignIssue < ActiveRecord::Base
belongs_to :source
belongs_to :election
has_many :candidate_statements
has_many :candidates, :through => "CandidateStatement"
has_many :custom_notes, :as => :object
end
|
class UsersController < ApplicationController
before_action :authenticate_user!, only: [:edit, :update]
before_action :authenticate_admin!, only: [:destroy]
def show
@user = User.find(params[:id])
end
def edit
@user = User.find(params[:id])
end
def update
@user = User.find(params[:id])
if... |
class TitleFetcher
attr_reader :url
def initialize url
@url = url
end
def title
@title ||= doc.title
end
def errors
@errors ||= []
end
def success?
errors.empty?
end
private
def response
@response ||= fetch
end
def fetch
response = Typhoeus.get(url, followlocatio... |
# Part1: Hello World
class HelloWorldClass
def initialize(name)
@name = name.capitalize
end
def sayHi
puts "Hello #{@name}!"
end
end
hello = HelloWorldClass.new("{Ryan}")
# hello.sayHi
# Part2: Strings
def palindrome?(string)
stringLowerCase = string.downcase
tempStrArray = Array.new()
tempStrAr... |
require 'spec_helper'
RSpec.describe Orga::ConferencesController do
render_views
it_behaves_like 'redirects for non-admins'
context 'with admin logged in' do
include_context 'with admin logged in'
describe 'GET index' do
it 'renders the index template' do
get :index
expect(respon... |
class AuthController < ApplicationController
def register
#create a new uswer
# byebug
register_params = params.permit(:username, :password, :email)
user = User.create(register_params)
if user.valid?
secret = Rails.application.secrets.secret_key_base
# also send back a token so they ... |
require "test_helper"
class SampleTest < ActiveSupport::TestCase
# Called before every test method runs. Can be used
# to set up fixture information.
test "validation" do
s = Factory :sample,:title =>"TestSample"
assert s.valid?
s.title= nil
assert !s.valid?
s.title=""
assert !s.vali... |
class Patient
attr_accessor :name,:appointments
@@all = []
def initialize(name)
@name = name
@@all << self
end
def self.all
@@all
end
def new_appointment(doctor,date)
Appointment.new(date,self,doctor)
end
def appointments
Appointment.all.select{|appointment| appointment.patient =... |
class Role < ActiveRecord::Base
has_many :role_memberships
has_many :users, :through => :role_memberships
has_many :departments, :through => :role_memberships
end
|
# frozen_string_literal: true
require 'json'
require 'field_serializer'
require_relative 'member'
class Members
include FieldSerializer
def initialize(url)
@url = url
end
field :members_of_the_lower_house do
lower_house_members.map do |mem|
Member.new(mem)
end
end
def json_for(url)
... |
# frozen_string_literal: true
require 'common/client/base'
require 'common/exceptions/internal/record_not_found'
require 'common/exceptions/external/gateway_timeout'
require 'common/client/concerns/monitoring'
module EVSS
module Letters
class Service < EVSS::Service
include Common::Client::Monitoring
... |
class RenameRssReaderTable < ActiveRecord::Migration
def change
rename_table :rssreader, :rssreaders
end
end
|
require 'json'
class DonationsController < ApplicationController
# before_filter :authenticate_user!, :except => [:index, :show]
# before_filter :authenticate_owner!, :only => [:edit, :update, :delete]
load_and_authorize_resource :project
load_and_authorize_resource :donation, :through => :project, :message ... |
class Baani < ActiveRecord::Base
has_many :lines
has_many :translations
validates :name, presence: true
validates :slug, presence: true, uniqueness: true
validates :version, presence: true, numericality: { greater_than: 0 }
end
|
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
abort("The Rails environment is running in production mode!") if Rails.env.production?
require 'spec_helper'
require 'rspec/rails'
require 'capybara/rails'
require 'support/factory_girl'
require 'factory_girl_rails'
require 'data... |
# code your #valid_move? method here
def valid_move?(array, position)
if ( position.between?(0, 8) && position_taken?(array, position) )
return true
end
end
# re-define your #position_taken? method here, so that you can use it in the #valid_move? method above.
def position_taken?(array, position)
if (array[... |
# frozen_string_literal: true
require 'rails/generators'
require 'rails/generators/base'
require_relative 'core'
require_relative 'relay'
module Graphql
module Generators
# Add GraphQL to a Rails app with `rails g graphql:install`.
#
# Setup a folder structure for GraphQL:
#
# ```
# - app/
... |
class Education < ActiveRecord::Base
validates_presence_of :year
belongs_to :employee_master
end
|
# encoding: utf-8
require "logstash/inputs/base"
require "logstash/namespace"
# Receive events using the lumberjack protocol.
#
# This is mainly to receive events shipped with lumberjack,
# <http://github.com/jordansissel/lumberjack>
class LogStash::Inputs::Lumberjack < LogStash::Inputs::Base
config_name "lumberja... |
module Apprenticeships
class PasswordsController < Base::PasswordsController
protected
def new_password_path
apprenticeships_new_user_password_path
end
def edit_password_path
apprenticeships_edit_user_password_path
end
def after_password_reset_path
apprenticeships_password... |
class CreateUsageTypes < ActiveRecord::Migration
def change
create_table :usage_types, id: false do |t|
t.integer :type_id_usg
t.integer :guide_to
t.integer :point_category
t.integer :origin_country_dial_code_req
t.integer :tax_code_origin_req
t.integer :tax_code_target_req
... |
class Team < ActiveRecord::Base
has_many :users
has_many :invitations
mount_uploader :picture, TeamPictureUploader
extend FriendlyId
friendly_id :name, use: :slugged
end
|
class CategoriaPostsController < ApplicationController
before_action :set_categoria_post, only: [:show, :edit, :update, :destroy]
# GET /categoria_posts
# GET /categoria_posts.json
def index
@categoria_posts = CategoriaPost.all
end
# GET /categoria_posts/1
# GET /categoria_posts/1.json
def show
... |
class ReceivedProductSerializer
include FastJsonapi::ObjectSerializer
attributes :demanded_product_id, :received_amount
end
|
module OrientdbBinary
class Database
class Segment
attr_reader :name, :location, :database
# Initialize connection to segments
#
# @since 1.0
def self.initialize_with(database)
Segment.new(database)
end
# Initialize connection to segments
#
# @since ... |
# encoding: utf-8
require File.expand_path("../spec_helper", __FILE__)
describe "Button" do
before :each do
browser.goto(WatirSpec.files + "/forms_with_input_elements.html")
end
# Exists method
describe "#exists?" do
it "returns true if the button exists" do
browser.button(:id, "new_user_submit"... |
# ensure the RAILS_ENV gets reset correctly after scenarios that set RAILS_ENV
# to 'production', e.g., the CAS scenarios
After("@production_rails_env") do
ENV['RAILS_ENV'] = 'cucumber'
end
# running Selenium tests requires turning off transactional fixtures
# so we need to manually clear database tables on Scenario... |
class FontCambay < Formula
head "https://github.com/google/fonts.git", verified: "github.com/google/fonts", branch: "main", only_path: "ofl/cambay"
desc "Cambay"
homepage "https://fonts.google.com/specimen/Cambay"
def install
(share/"fonts").install "Cambay-Bold.ttf"
(share/"fonts").install "Cambay-Bold... |
class Notice < ApplicationRecord
belongs_to :user
def self.inform(user_id,content,type,url)
Notice.create(user_id:user_id,content:content,notice_type:type,url:url)
end
end
|
require 'rhodes_analytics/analytics_object'
module RhodesAnalytics
class Event < AnalyticsObject
HITTYPE = "event"
FIELD_MAPPING = {
category: "ec",
action: "ea",
label: "el",
value: "ev"
}
end
end |
class Tag < ApplicationRecord
has_many :book_tags, dependent: :destroy, foreign_key: 'tag_id'
has_many :books, through: :book_tags
belongs_to :person, optional: true
end
|
class AnimaliaBot
module Listener
module CallbackMessages
def process
distribute_by_mods
end
def distribute_by_mods
case Listener.player.mode
when Listener::ModeValues::REGISTER
Listener::Mode::Register.callback_message(Listener.message.message, Listener.message.data)
when Liste... |
require 'spec_helper'
describe 'docker::binary' do
context 'by default' do
let(:chef_run) do
ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '12.04') do |node|
node.automatic['kernel']['release'] = '3.8.0'
end.converge(described_recipe)
end
it 'downloads docker binary' do
... |
# encoding: utf-8
module Ktl
class ContinousReassigner < Reassigner
include ZkClient::IZkDataListener
def initialize(zk_client, options={})
super(zk_client, options)
@latch = JavaConcurrent::CountDownLatch.new(1)
@sleeper = options[:sleeper] || java.lang.Thread
@delay = options[:dela... |
class Friend
def greeting(*message)
(message.empty?) ? "Hello!" : "Hello, #{message[0]}!"
end
end |
class Product < ApplicationRecord
validates :thing, presence: true
end
|
require 'digest/sha1'
class User < ActiveRecord::Base
include Authentication
include Authentication::ByPassword
include Authentication::ByCookieToken
include Authorization::AasmRoles
has_many :bonds,:dependent => :destroy
has_many :roles, :dependent => :destroy
has_many :searches, :dependent => :destroy... |
class Api::PistolsController < ApplicationController
before_action :authenticate_user!, only: [:my_pistol, :update, :delete, :update_modifications]
before_action :set_pistol, only: [:update, :destroy, :update_pistol]
def index
render json: Pistol.all
end
def my_pistol
render json: User.mine(current_... |
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
####
# Welcome to your project's Gemfile, used by Rubygems & Bundler.
#
# To install a plugin, run:
#
# bundle add new-plugin-name -g bridgetown_plugins
#
# This will ensure the plugin is added to the correct Bundler group.... |
module Openbeautyfacts
class Locale < String
GLOBAL = 'world'
class << self
# Get locales
#
def all(domain: DEFAULT_DOMAIN)
url = "https://#{domain}/"
body = open(url).read
dom = Nokogiri.parse(body)
dom.css('ul li a').map { |locale_link|
locale_... |
FactoryBot.define do
factory :article do
sequence(:title) { |n| "article_title #{n}" }
sequence(:like) { 0 }
end
end
|
class CreateBeerMeSearches < ActiveRecord::Migration
def change
create_table :beer_me_searches do |t|
t.string :style
t.integer :acidic
t.integer :clean
t.integer :creamy
t.integer :crisp
t.integer :hoppy
t.integer :malty
t.integer :rich
t.integer :smooth
... |
class AddColumnToArtShares < ActiveRecord::Migration[5.2]
def change
add_column :art_shares, :favorite, :integer
add_index :art_shares, [:favorite, :viewer_id], unique: true
end
end
|
#
# 2048-2600 needs its graphics to be upside down and right-to-left
# (ok, I could have used REFPn for the later). This script converts
# them to an .asm source file that can be used on the main program.
#
glyphs = <<END
;;;;;;;;;;;;;;
;; GRAPHICS ;;
;;;;;;;;;;;;;;
; Tiles are 8 x 11 to partially compensate for
; A... |
# frozen_string_literal: true
Rails.application.routes.draw do
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
resources 'orders', only: %i[index show]
post 'orders/upload'
root to: 'orders#index'
end
|
class V1::Dashboards::Admin::UsersController < V1::BaseController
before_filter :authorize_user
def index
users = User.where("id != ?", current_user.id).
paginate(page: 1, per_page: 30)
user_json = ActiveModel::ArraySerializer.new(users, each_serializer: ::User::InfoSerializer)
render status: 200... |
class Stormpath::Resource::OauthPolicy < Stormpath::Resource::Instance
prop_accessor :access_token_ttl, :refresh_token_ttl
belongs_to :application
end
|
require_relative './init'
RSpec.configure do |config|
config.include FactoryGirl::Syntax::Methods
end
describe "Reset Password Token" do
before do
IntegrationSpecHelper.InitializeMongo()
end
before(:each) do
Helper.destroy_all
ResetPasswordToken.destroy_all
end
it "Can create a token" do
h... |
describe Parser::IadCases20200815 do
include_context "parser"
let(:file) { file_fixture("sample_iad_cases_20200815.csv") }
it "parses a row" do
expect(record[:ia_no]).to eql("IAD2016-0187")
expect(record[:incident_type]).to eql("Internal investigation")
expect(record[:received_date]).to eql("5/5/16")... |
require "rails_helper"
describe FirstAssociatesReportLoader do
let(:file_path) { Rails.root.join 'spec/fixtures/Sample Loan Report Pack.xlsx' }
let(:admin) { create :admin }
subject { described_class.new admin, file }
shared_examples "a First Associates report loader" do
it "returns true" do
expect(... |
require "nice_acl/version"
module NiceAcl
class Error < StandardError; end
def self.hello_world
"Hello World"
end
end
|
require 'rails_helper'
describe UsersController do
let(:user) { create :user }
describe 'GET #index' do
it "assigns a User to @user" do
session[:user_id] = create(:user).id
get :new
expect(response).to be_success
end
it "renders the :new template" do
session[:user_id] = creat... |
require 'spec_helper'
describe 'Debits' do
before(:each) do
visit root_path
@user = FactoryGirl.create(:user)
@user1 = FactoryGirl.create(:user1)
@user2 = FactoryGirl.create(:user2)
@friend = FactoryGirl.create(:friend)
@debit1 = FactoryGirl.create(:debit1)
@debit2 = FactoryGirl.create(:debit2)
end
it "listi... |
#
# Cookbook Name:: service_factory
# Library:: provider_init
#
# Author:: BinaryBabel OSS (<projects@binarybabel.org>)
# Homepage:: http://www.binarybabel.org
# License:: Apache License, Version 2.0
#
# For bugs, docs, updates:
#
# http://code.binbab.org
#
# Copyright 2013 sha1(OWNER) = df334a7237f10846a0ca302bd32... |
require 'spec_helper'
describe Honeybadger::Api::Project do
describe "initializing a new project" do
before :all do
@project = FactoryGirl.build :project
end
it "should have an identifier" do
@project.id.should == 1
end
it "should have a name" do
@project.name.should == "Rail... |
class GithubService
class Error < StandardError; end
def initialize project_path, access_token
@project_path = project_path
@client = Octokit::Client.new(access_token: access_token)
end
def last_commit
commits.first
end
def create_comment sha, message
@client.create_commit_comment(@projec... |
class ChangeAmountOfDeals < ActiveRecord::Migration
def up
rename_column :deals, :amount, :amount_cents
add_column :deals, :currency, :string, :null => false, :default => "USD"
end
def down
rename_column :deals, :amount_cents, :amount
remove_column :deals, :currency
end
end
|
class CreateMomentumCmsFiles < ActiveRecord::Migration
def change
create_table :momentum_cms_files do |t|
t.string :label
t.string :tag
t.string :identifier
t.boolean :multiple, default: false
t.references :site, index: true
t.references :attachable, polymorphic: true
t.t... |
# frozen_string_literal: true
module Ruboty
module Handlers
class Github < Base
ISSUE_PATTERN = %r{(?:https?://[^/]+/)?(?<repo>.+)(?:#|/pull/|/issues/)(?<number>\d+) ?}.freeze
env :GITHUB_BASE_URL, 'Pass GitHub URL if needed (e.g. https://github.example.com)', optional: true
on(
/crea... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.