text stringlengths 10 2.61M |
|---|
require 'rails_helper'
describe "games/new", type: :view do
let(:game) {build :game}
before(:each) do
allow(controller).to receive(:can?).and_return(true)
assign(:game, game)
end
it "renders new game form" do
render
assert_select "form[action='#{games_path}'][method='post']" do
assert_... |
#
# Cookbook Name:: rs-lamp
# Recipe:: dump_import
#
# Copyright (C) 2014 RightScale, Inc.
#
# 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
#
... |
require 'spec_helper'
describe 'routing to api/feed' do
%w(discover subscribed).each do|name|
it "routes #{name} via GET" do
expect(get("/api/feed/#{name}")).to route_to(controller: 'api/feed', action: name)
end
it "routes #{name} via POST" do
expect(post("/api/feed/#{name}")).to route_to(co... |
class CreateCriterios < ActiveRecord::Migration
def self.up
create_table :criterios do |t|
t.boolean :inclusao_idade
t.boolean :inclusao_diagnostico_hanseniase
t.boolean :inclusao_duracao_sintomas
t.boolean :inclusao_duracao_dor
t.boolean :inclusao_virgem_tratamento
t.boolean :... |
# Michael Molisani (github.com/molisani)
remote_file "#{Chef::Config[:file_cache_path]}/cygwin-setup.exe" do
source node['cygwin']['setup'][node['cygwin']['arch']]
backup false
action :create
end
execute "initial setup" do
cwd Chef::Config[:file_cache_path]
command "cygwin-setup.exe -q -R #{node['cygwin'][... |
module AnswersHelper
def answer_form_options(answer)
if answer.new_record?
{model: [answer.question, answer]}
else
{model: answer, class: 'hidden', id: "edit-answer-#{answer.id}"}
end
end
def answer_errors_div_id(answer)
answer.new_record? ? 'new-answer-errors' : "answer-#{answer.id}-... |
class Admin::BlackDomainsController < ApplicationController
before_filter :authenticate_user!
before_filter :admin_required
def index
@black_domains = BlackDomain.all
end
def create
@black_domain = BlackDomain.new(params[:black_domain])
respond_to do |format|
if @black_domain.save
... |
class AddEndTimeAndWinnersDeterminedToPrompts < ActiveRecord::Migration
def change
add_column :prompts, :end_time, :datetime
add_column :prompts, :winners_determined, :boolean
end
end
|
module Smtp
class Subject
def initialize(value)
@value = value
end
def as_header
@header ||= Header.new(Header::SUBJECT, @value)
end
end
end
|
require_relative '../acceptance_helper'
feature 'edit answer' do
given!(:current_user) { create(:user) }
given!(:other_user) { create(:user) }
given!(:question) { create(:question, user: current_user) }
given!(:other_question) { create(:question, user: other_user) }
given!(:answer) { create(:answer, quest... |
require "metaid"
require "bigdecimal"
require "bigdecimal/util"
files = %w[
deprecated core_ext core_sql connection_pool exceptions pretty_table
dataset migration schema database worker object_graph
]
dir = File.join(File.dirname(__FILE__), "sequel_core")
files.each {|f| require(File.join(dir, f))}
module Sequel ... |
class RemoveLegacyAttributes < ActiveRecord::Migration
def change
drop_table :task_objective_revisions
drop_table :task_state_revisions
end
end
|
class Router
def initialize(controller)
@controller = controller
end
def run
loop do
# print_menu
print_menu
# User choice
action = gets.chomp.to_i
# Do the right the action
case action
when 1 then @controller.display
when 2 then @controller.add_task
... |
class CreateComments < ActiveRecord::Migration
def self.up
create_table :comments do |t|
t.integer :patient_condition
t.string :medication
t.string :doctor_id
t.integer :is_recommended, :default => 0
t.integer :recommendation_status, :default => 0
t.belongs_to :appointment, :in... |
require_relative '../../lib/mince_dynamo_db/interface'
describe MinceDynamoDb::Interface do
let(:db) { mock 'dynamo db connection', tables: { collection_name => collection } }
let(:mince_dynamo_db_connection) { mock 'mince dynamo db connection', connection: db }
let(:collection) { mock 'some collection', items: ... |
class StudentNenjisController < ApplicationController
def index
list
render :action => 'list'
end
# GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
verify :method => :post, :only => [ :destroy, :create, :update ],
:redirect_to => { :action => :list }
def list
... |
# == Schema Information
#
# Table name: companies
#
# id :integer not null, primary key
# name :string not null
# logo_file_name :string
# logo_content_type :string
# logo_file_size :integer
# logo_updated_at :datetime
# description :text d... |
class DelayedAdditionalReportCsv
attr_accessor :csv_report_id
def initialize(csv_report_id)
@csv_report_id = csv_report_id
end
def perform
@csv_report=AdditionalReportCsv.find(@csv_report_id)
@csv_report.csv_generation
end
end |
require 'test/unit'
require 'rcapdissector'
module TestData
TEST_DATA_DIR = File.dirname(__FILE__) + "/testdata/"
BOGUS_CAP = TEST_DATA_DIR + 'nonexistantcapturefile'
CORRUPTED_CAP = TEST_DATA_DIR + 'corrupted.cap'
TEST_CAP = TEST_DATA_DIR + 'test.cap'
HUGE_CAP = TEST_DATA_DIR + 'huge_d... |
class ReviewReportsController < ApplicationController
layout "qameha"
before_filter :login_required
before_filter :check_state, :only => :edit
load_and_authorize_resource :except => [:new]
# GET /review_reports
# GET /review_reports.xml
def index
@campaign = @current_account.campaigns.find(p... |
require 'factory_girl'
module FactoryMacros
def self.create_file(path)
file = File.new(path)
file.rewind
return ActionDispatch::Http::UploadedFile.new(:tempfile => file, :type => "image/png", :filename => File.basename(file))
end
end
FactoryGirl.define do
factory :store_image, class: StoreImage do ... |
module TavernaPlayer
class RunPort < ActiveRecord::Base
include TavernaPlayer::Concerns::Models::RunPort
def file_extension
if metadata.nil?
nil
else
if metadata[:type].is_a?(Array)
type = metadata[:type].flatten.first # This works because list elements always share a mi... |
class MessageFormatter
def initialize(file)
@file = file.chomp
end
def split_lines
@file.chars.each_slice(40).map(&:join)
end
end
|
class CategoriesController < ApplicationController
before_action :admin_user, only: [:destroy, :edit, :update, :create]
def index
@categories = Category.all
end
def new
@category = Category.new
end
def show
@category = Category.find_by(name: params[:name])
@products = @category.products.paginate(page: ... |
# == Schema Information
#
# Table name: transactions
#
# id :integer not null, primary key
# amount :decimal(8, 2) default(0.0)
# message :text
# correlation_token :string(50) default(""), not null
# account_id :integer not null
# ref_acco... |
class AddKdToAlbumOrders < ActiveRecord::Migration
def self.up
add_column :album_orders, :kd, :string
end
def self.down
end
end
|
# -*- coding: utf-8 -*-
module GoogleBookSearchHelper
def create_google_book_search_stub(title="長嶋茂雄")
stub_response = <<"EOJSON"
{
"responseData": {
"results": [
{
"GsearchResultClass": "GbookSearch",
"unescapedUrl": "http://books.google.com/books?id=uG14CgAAQBAJ&pg=RA3-PA57&dq=#{titl... |
# find the value of d within [1,1000) for which 1/d
# contains the longest recurring cycle in its decimal fraction
require 'bigdecimal'
decimals = (1..999).to_a.map { |x| BigDecimal.new('1.0').div(x, 500) }
# this has something to do with finding the longest repeating substring
def longest_recurring_cycle(string)
... |
class GamesControllerController < ApplicationController
def new
@letters = generate_grid(6)
end
def generate_grid(grid_size)
Array.new(grid_size) { ('A'..'Z').to_a.sample }
end
def included?(guess, grid)
guess.chars.all? { |letter| guess.count(letter) <= grid.count(letter) }
end
def english_word?(... |
require File.join(File.dirname(__FILE__), '../iis/iis_object')
Puppet::Type.type(:iis_app).provide(:iis_app, :parent => Puppet::Provider::IISObject) do
desc "IIS App"
confine :operatingsystem => :windows
defaultfor :operatingsystem => :windows
commands :appcmd => File.join(ENV['SystemRoot'] || 'c:/wi... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
class Api::V1::AppointmentsController < ApplicationController
def index
appointments = Appointment.all
render json: appointments, except: [:updated_at, :created_at], status: :ok
end
def show
appointment = Appointment.find_by(id: params[:id])
render json: appointment, except: [:updated_at, :creat... |
class AddVideoTypeIdToDefinitions < ActiveRecord::Migration
def change
add_column :definitions, :video_type_id, :integer
add_index :definitions, :video_type_id
end
end
|
# frozen_string_literal: true
module Api::V1::SC::Billing::Stripe
class ProductSerializer < Api::V1::BaseSerializer
type 'products'
attributes :id,
:name,
:stripe_id
end
end
|
require 'rails_helper'
describe "Voting", type: :feature do
it 'can upvote a question' do
user = create(:user, email: "jon@example.com")
user.questions.create(title: "Do I need a CS degree?", body: "I want to be a web developer")
register_a_user("nando@example.com", "Nando", "Hasselhoff")
visit ques... |
require_relative 'base_markdown_renderer'
module GroupBuzz
class EmailBodyRenderer < GroupBuzz::BaseMarkdownRenderer
def initialize(keep_image_alt_text: keep_image_alt_text = false)
super()
@keep_image_alt_text = keep_image_alt_text
end
def double_emphasis(text)
enclose_with('*', text... |
json.array!(@service_station_administrator_service_station_ships) do |service_station_administrator_service_station_ship|
json.extract! service_station_administrator_service_station_ship, :id, :service_station_administrator_id, :service_station_id
json.url service_station_administrator_service_station_ship_url(serv... |
require_relative '../../app.rb'
RSpec.feature "Battle" do
scenario "expect homepage to contain text" do
visit "/"
expect(page).to have_current_path('/start_battle')
end
scenario "prints input names on screen" do
sign_in_and_play
expect(page).to have_text('Player 1 (Karim)')
expect(page).to ha... |
Rails.application.routes.draw do
resources :favorites
resources :shows
resources :genres
resources :movies
resources :users
post '/login', to: 'auth#login'
get '/persist', to: 'auth#persist'
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
end
|
#!/usr/bin/env ruby
#/ Usage: watch
#/
#/ Run the tests whenever any relevant files change.
#/
require "pathname"
require "rubygems"
require "bundler"
Bundler.setup :watch
# Put us where we belong, in the root dir of the project.
Dir.chdir Pathname.new(__FILE__).realpath + "../.."
# Run the tests to start.
system "c... |
module GemDump
VERSION = "0.0.1"
class Exporter
# List all installed gems
def self.export(filename, options = {})
begin
exporter = new
result = exporter.export(filename)
rescue => ex
raise Gem::Exception, "Ops! An unexpected error occurred: #{ex.message}"
end
... |
require 'rails_helper'
RSpec.describe Customer, type: :model do
describe '.acquire_access_token!' do
let(:customer) { FactoryBot.create(:customer) }
it 'return access_token if exist' do
access_token = 'fksahdfkadbshbkjdfsa'
customer.access_token = access_token
customer.save!
customer.... |
require 'git_commit'
describe GitCommit do
let(:commit_text) do
<<-EOS
commit 729c61508b58c9f82b56c7fca130a0e94380b1d1
Author: John Doe <johndoe@example.com>
Date: 2014-04-09
... |
Pod::Spec.new do |s|
s.name = "ESDatePicker"
s.version = "1.3"
s.platform = :ios, "7.0"
s.summary = "Again another date picker"
s.author = { "Bas van Kuijck" => "bas@e-sites.nl" }
s.license = { :type => "BSD", :file => "LICENSE" }
s.homepage = "https://gi... |
require 'test_helper'
class CashExpensesControllerTest < ActionController::TestCase
setup do
@cash_expense = cash_expenses(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:cash_expenses)
end
test "should get new" do
get :new
assert_res... |
require 'rails/generators'
require 'fileutils'
module SubjectService
extend self
def build(name)
Rails::Generators.invoke 'subject', [ name, "--skip" ]
end
def subject_root
File.join(Rails.root, Settings.sites.system.root, "subjects")
end
def subject_path(subject)
File.join(subject_root, su... |
class Api::V1::BaseController < ApplicationController
protect_from_forgery unless: -> { request.format.json? }
include Response
include ExceptionHandler
include ApplicationHelper
# called before every action on controllers
before_action :authorize_request
attr_reader :current_user
private
# Check ... |
FactoryBot.define do
factory :content do
title { Faker::Book.title }
#published_date { Faker::Time.between(DateTime.now - 1, DateTime.now) }
published_date { Time.now + 3 }
author { Faker::Book.author }
summary { Faker::Book.title }
content { Faker::Book.title}
status { "published" }
e... |
=begin
#===============================================================================
Title: Enemy Class
Author: Hime
Date: Sep 9, 2014
--------------------------------------------------------------------------------
** Change log
Sep 9, 2014
- added support for "add base params", which was not added for some... |
# frozen_string_literal: true
class SinglePageAppController < ApplicationController
def index; end
def api_not_found
render status: :not_found, json: { message: "No such api" }
end
end
|
class RemoveNullFalseForMatches < ActiveRecord::Migration[5.1]
def change
change_column_null :matches, :contestant_two_id, true
end
end
|
class PostsController < ApplicationController
before_action :set_profile
before_action :set_post, except: [:new, :create]
def show
paginate(page: params[:page], per_page: 15)
end
def new
@post = @profile.posts.new
end
def create
@post = @profile.posts.new(post_params)
@post.feed_id = Fe... |
FactoryGirl.define do
factory :contestant do
name 'Banban'
end
end |
# frozen_string_literal: true
require 'test_helper'
module BasicCommand
class BaseTest < MiniTest::Test
class MultiplicationCommand < Base
attr_accessor :x, :y
validates :x, presence: true
validates :y, presence: true
def initialize(x, y)
@x = x
@y = y
end
... |
######################
# Board Class Errors #
######################
class BoardOutOfBoundsError < StandardError
end
class InvalidMoveError < StandardError
end
########################
# Display Class Errors #
########################
class InvalidInputError < StandardError
end
class SelectionQueueOverflowError < ... |
require 'rails_helper'
describe EncryptedKeyMaker do
let(:password) { 'sekrit' }
let(:salt) { 'mmmm salty' }
let(:ciphered_key) { SecureRandom.random_bytes(32) }
let(:random_R) { SecureRandom.random_bytes(32) }
let(:user_access_key) { UserAccessKey.new(password: password, salt: salt) }
let(:hash_E) { OpenS... |
class TagsController < ApplicationController
def index
@tags = Tag.all
@guides = Guide.all
end
def new
@tag = Tag.new
end
def create
@tag = Tag.create(tag_params)
redirect_to tags_path
end
def edit
@tag = Tag.find(params[:id])
end
def show
@tag = Tag.find(params[:id])
... |
class Helper
def initialize
end
# Helper method for generate_maze and maze_solver. As long as the user does not provide a valid input,
# Whether that be because the value is not a number or not within the specified bound,
# keep bugging them until they do.
def get_valid_numbers_only(coord, bound)
... |
require 'test_helper'
# bundle exec ruby -Itest test/models/user_test.rb
class UserTest < ActiveSupport::TestCase
test "sets default role as project_user" do
user = User.create!(
name_ciphertext: User.generate_name_ciphertext("McClain Fox").inspect,
name_bidx: User.generate_name_bidx("McClain Fox").i... |
class Song
attr_accessor :name, :artist_name
@@all = []
def self.all
@@all
end
def save
self.class.all << self
end
def self.create #instantiates and saves the song, returns the new song
song = self.new
song.save
song
end
def self.new_by_name(name) #instantiates with a song with... |
# frozen_string_literal: true
Then(/^the user should not be able to access the wrong credentials/) do |credentials|
log_in_page = LoginScreen.new
expect(log_in_page.email_input.displayed?).to be true
credentials.hashes.each do |credential|
log_in_page.sign_in(credential['email'], credential['password'])
... |
require 'test_helper'
class EventTest < ActiveSupport::TestCase
def setup
@event = events(:pickup)
@pk = @event.id
end
test "valid time should be OK" do
@event.start_time = "10:00pm"
assert @event.save
end
test "blank time should fail" do
@event.start_time = ""
assert_not @event... |
# frozen_string_literal: true
module Vedeu
module Coercers
# Provides the mechanism to convert a value into a
# {Vedeu::Geometries::Position}.
#
# @api private
#
class Position < Vedeu::Coercers::Coercer
# @macro raise_fatal
# @return [NilClass|Vedeu::Geometries::Position]
... |
require 'user'
describe User do
it '.all returns a list of users' do
User.create('manuel@garcha.com', '1234', 'manuel', 'manuelgarcha')
User.create('jorge@garcha.com', '1234', 'jorge', 'jorgegarcha')
User.create('cristobal@garcha.com', '1234', 'cristobal', 'cristobalgarcha')
users = User.all
us... |
# Copyright 2019 The inspec-gcp-cis-benchmark Authors
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
class Outstation < ActiveRecord::Base
mount_uploader :attachment, OutstationAttachmentUploader
attr_accessible :user_id,:is_out_of_state,:is_official,:placename,:from_date,:to_date,:state,:country,:purpose,:total_expenditure,:cause_spending,:attachment,:status
validates :placename,:from_date,:to_date,:purpose... |
module Api
module V1
class PositionsController < ApplicationController
#http_basic_authenticate_with name: "admin", password: "hejsan"
protect_from_forgery with: :null_session
#Make sure apikey is present
before_filter :restrict_acces... |
class Person < ActiveRecord::Base
concerned_with :awards, :marriages, :name, :roles, :social
default_scope :order => 'lastname, firstname, serial_number'
def self.find(*args)
args = args.dup
options = args.extract_options!.dup
if options[:order] =~ /\bname\b( (?:ASC|DESC))?/i
options[:order] =... |
require 'fluent/plugin/bare_output'
require_relative 'expander'
require 'forwardable'
require 'socket'
class Fluent::Plugin::ConfigExpanderOutput < Fluent::Plugin::BareOutput
Fluent::Plugin.register_output('config_expander', self)
helpers :event_emitter
config_param :hostname, :string, default: Socket.gethost... |
require_relative '../../app/utils/Generateur'
# Author:: BastienMor
# Developers: BastienMor
# Version:: 0.1
# Copyright:: © 2017
# License:: Distributes under the same terms as Ruby
#
##
## Classe de test unitaire du générateur de grille.
##
##
## Vérifie que chaque valeur est correcte
##
## @par... |
require 'protip/version'
require 'protip/client'
require 'protip/resource'
# Register the mime type with Rails, if Rails exists.
if defined?(Mime::Type)
Mime::Type.register 'application/x-protobuf', :protobuf
end
module Protip
def self.default_transformer
@default_transformer ||= Protip::Transformers::Default... |
# Delegation directives.
# Author:: Peter Kofler
module DelegateDirective # :nodoc:
# Directive to create a delegating method _method_name_ to the result of my own method _delegate_ without arguments.
def delegate(method_name, delegate)
self.module_eval("def #{method_name}(*obj) #{delegate}.#{... |
require 'spec_helper'
describe Widget do
it "requires a name" do
widget = Widget.create(description: "hi")
widget.errors[:name].first.should == "can't be blank"
end
it "requires a description" do
widget = Widget.create(name: "hi")
widget.errors[:description].first.should == "can't be blank"
en... |
RSpec.describe NxtPipeline::Pipeline do
let(:input) { '' }
context 'add steps subsequently' do
subject do
NxtPipeline::Pipeline.new do |p|
p.constructor(:proc, default: true) do |acc, step|
step.argument.call(acc)
end
p.step ->(arg) { arg + 'first ' }
p.step ->(... |
# db/migrate/002_create_scenarios.rb
class CreateScenarios < ActiveRecord::Migration[6.1]
def change
enable_extension 'hstore' unless extension_enabled?('hstore')
create_table :scenarios do |t|
t.belongs_to :user, null: false, foreign_key: true
t.string :name
t.text :description
t.st... |
class Api::SessionsController < ApplicationController
skip_before_action :authenticate_user_from_token!
# before_action :authenticate_user!
# POST /v1/login
def create
@user = User.find_for_database_authentication(email: params[:email])
# binding.pry
return invalid_email unless @user
... |
ActiveAdmin.register User do
scope :All
scope :patients
scope :doctors
filter :first_name
filter :last_name
filter :email
filter :dob
filter :contact_no
# See permitted parameters documentation:
# https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-str... |
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe ApplicationController, type: :controller do
describe 'GET #index' do
let(:request_params) { { method: :get, action: :index } }
it 'renders index template' do
do_request(request_params)
expect(response).to render_template :inde... |
class AlterTableIssuesAddSeverityColumn < ActiveRecord::Migration
def self.up
add_column :issues, :severity, :string, :default => "non-emergency", :null => "false"
end
def self.down
remove_column :issues, :severity
end
end
|
json.array!(@favorite_classes) do |favorite_class|
json.extract! favorite_class, :dance_class_id, :user_id
json.url favorite_class_url(favorite_class, format: :json)
end
|
class Action < ApplicationRecord
has_many :plants_actions
has_many :plants, through: :plants_actions
accepts_nested_attributes_for :plants_actions, :allow_destroy => true
validates_presence_of :action_name, :message => "Can't be blank"
validates_uniqueness_of :action_name, :message => "Must be unique"
de... |
require 'test_helper'
class CustomerVaultApiCardsTest < Minitest::Test
def test_create_card_with_address_id
card = VCR.use_cassette('customer_vault_api/create_card_with_address_id') do
profile = create_test_profile
address = authenticated_client.customer_vault.create_address(
profile_id: pr... |
require 'yaml/store'
require 'fileutils'
class YashConfig
include Enumerable
def initialize(options)
@config = options if sanity_check(options)
@config.merge!(read_config)
write_config
end
def [](key)
@config[key]
end
def []=(key, value)
begin
FileUtils.mv(@config[:config_file], value) if check_k... |
class Karta
attr_reader :value, :mast
@@masts = ['Pika', 'Chirva', 'Hrest', 'Buba']
def initialize(value, mast)
@value = value
@mast = @@masts[mast]
end
def to_s
"#{@value} #{@mast}"
end
end |
class DocumentGroupsController < ApplicationController
# GET /document_groups
# GET /document_groups.xml
def index
@document_groups = DocumentGroup.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @document_groups }
end
end
# GET /document_groups/1... |
require 'rails_helper'
describe "Visiting the video index page" do
before(:each) do
Video.__elasticsearch__.delete_index!
5.times do
@video = FactoryBot.create(:video)
@video.save
end
end
Video.__elasticsearch__.refresh_index!
before { visit videos_path }
subject { page }
i... |
# frozen_string_literal: true
require 'rom/repository'
module NewDawn
class Repository
class << self
def [](*args)
ROM::Repository[*args].include Inject.args['persistence.rom']
end
end
end
end
|
class AddCityOrRegionToAddress < ActiveRecord::Migration
def change
add_column :addresses, :city_or_region, :string
end
end
|
class User < ActiveRecord::Base
has_secure_password
has_many :items
has_many :comments
has_many :stocks
has_many :items_stocked, through: :stocks, source: :item
# 細かいですが、class_nameもシンボルで統一したいです。
has_many :active_follow_users, class_name: :FollowUser, foreign_key: :follower_id
has_many :passive_follow_u... |
class Model::Page::FindExam < SitePrism::Page
set_url "#{Helpers::Config['pf_site_root']}/Exam/FindExam"
element :location_vienna, '#Locations_0_LocationId'
element :date_error,'#lblRegDatesErrorMsg'
elements :add_record,'[href*="GetExamById"]'
element :records_count,'.jtable-page-info'
element :search_butt... |
require 'spec_helper'
describe CommentsController do
before do
mock_geocoding!
@tailgate = FactoryGirl.create(:tailgate)
@post = @tailgate.posts.create(user_id:@tailgate.user.id, content:"post content")
end
def valid_attributes
{
content: "content",
user_id: @post.user_id
}
en... |
class TaskList < ActiveRecord::Base
has_many :tasks, dependent: :destroy
has_many :users
end
|
class RedcarpetRenderExtended < Redcarpet::Render::HTML
def image(link,title,alt_text)
figcaption=title ? "<figcaption>#{title}</figcaption>" : ""
"<figure><img src=#{link} alt=#{alt_text}/>#{figcaption}</figure>"
end
def postprocess(full_document)
full_document.gsub(/<p>\s*<figure>/,"<figure>").gsub(/<\/figur... |
class UpdateTimeColumnName < ActiveRecord::Migration
def change
rename_column :events, :generic_time, :time_only
rename_column :events, :start_date, :date_only
end
end
|
require 'walkon/entrance_music'
# Represents a single Bluetooth device in the building. When HciTool
# detects the device on the network, it plays the entrance music.
module Walkon
class Device
attr_reader :ess_id, :entrance_music
def initialize from_ess_id
@ess_id = from_ess_id
@entrance_music... |
require 'spec_helper'
require 'cloudinary'
require 'faker'
require_relative '../../app/service_objects/image_uploader'
describe ImageUploader do
let(:image_uploader) { described_class.new(image_url) }
let(:image_url) { Faker::Internet.url }
let(:uploader) { Cloudinary::Uploader }
let(:options) do
... |
require 'test_helper'
class BingosControllerTest < ActionController::TestCase
setup do
@bingo = bingos(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:bingos)
end
test "should get new" do
get :new
assert_response :success
end
tes... |
class Persona < ApplicationRecord
validates :nombre, uniqueness: true
validates :apellido, uniqueness: true
def self.subir_excel(file)
@errores = []
file_ext = File.extname(file.original_filename)
raise "Unknown file type: #{file.original_filename}" unless [".xls", ".xlsx", ".csv"].inc... |
class NotificationRecipient < ActiveRecord::Base
belongs_to :notification
belongs_to :recipient, :class_name => 'User'
end |
# This file was generated by the `rspec --init` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# Require this file using `require "spec_helper"` to ensure that it is only
# loaded once.
#
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
#Cellu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.