text stringlengths 10 2.61M |
|---|
module Crawler
class Log
def self.http
@http ||= instantiate('http')
end
def self.app
@app ||= instantiate('app')
end
def self.instantiate(name)
Logger.new(open(name)).tap do |log|
log.progname = 'crawler'
log.level = Config['log_level']
end
end
d... |
require "elasticsearch"
require "elasticsearch/xpack"
require "json"
class ElasticConnector
def initialize(index: '', mapping: '')
@index = index
@mapping = mapping
@client = Elasticsearch::Client.new url: "http://elastic:changeme@localhost:9200"
check_index
end
def insert(json)
@client.crea... |
class Micropost < ActiveRecord::Base
attr_accessible :content, :lesson_id, :youtube_id, :title
belongs_to :user
has_many :critiques
before_create :strip_youtube_id
validates :user_id, presence: true
validates :youtube_id, presence: true
default_scope order: 'microposts.created_at DESC'
def self.f... |
# encoding: UTF-8
#
# Cookbook Name:: dovecot
# Author:: Xabier de Zuazo (<xabier@zuazo.org>)
# Copyright:: Copyright (c) 2016 Xabier de Zuazo
# Copyright:: Copyright (c) 2013-2015 Onddo Labs, SL.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not u... |
class Ability
include CanCan::Ability
def initialize(user)
user ||= User.new
if user.role == "admin"
can :manage, :all
else
can :read, :all
if user.role == "customer"
can :read, :all
can :create, Sale
can [:destroy, :update, :edit], Sale do |sale|
sale.user_id =... |
xml = Builder::XmlMarkup.new(:indent => 2)
xml.instruct!
xml_string = xml.rss('xmlns:atom' => "http://www.w3.org/2005/Atom", :version => "2.0") do
xml.channel do
if @user
xml.title("#{@user.login}'s Recent Events")
else
xml.title("Recent Events")
end
xml.description("Events recently report... |
module Fog
module Parsers
module Vcloud
class GetVersions < Fog::Parsers::Base
#
# Based off of:
# http://support.theenterprisecloud.com/kb/default.asp?id=535&Lang=1&SID=
# https://community.vcloudexpress.terremark.com/en-us/product_docs/w/wiki/02-get-versions.aspx
#... |
class Upload < ActiveRecord::Base
attr_accessible :upload
has_attached_file :upload,
:styles => { :thumb => "100X100#", :regular => "442X278#"},
:preserve_files => true,
:storage => :s3,
:s3_credentials => "#{::Rails.root.to_s}/config/s3.yml"
belongs_to :pr... |
def url_for_region(region)
region_urls = {
"eu-west-1" => "ec2.eu-west-1.amazonaws.com",
"us-east-1" => "ec2.us-east-1.amazonaws.com",
"ap-northeast-1" => "ec2.ap-northeast-1.amazonaws.com",
"us-west-1" => "ec2.us-west-1.amazonaws.com",
"ap-southeast-1" => "ec2.ap-southeast-1.amazonaws.com"
}
... |
class ContactFormsController < ApplicationController
respond_to :json,:js,:html,:xml
# GET /contact_forms
# GET /contact_forms.json
def index
@contact_forms = ContactForm.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @contact_forms }
end
end
# ... |
require 'spec_helper'
require 'json'
module OpenFec
RSpec.configure do |config|
config.before(:each) do
# Candidate Data
candidates_from_va = JSON.parse(File.read("spec/stubs/candidate/candidates_from_va.json"))
dem_candidates = JSON.parse(File.read("spec/stubs/candidate/dem_candidates.json"... |
class Subscriber < ActiveRecord::Base
has_many :subscriptions, :dependent => :destroy
has_many :tickers, :through => :subscriptions, :dependent => :destroy
validates_inclusion_of :status, :in => ['normal', 'wichtig']
def to_s
"#{jid} (#{status})"
end
end
|
class Product < ActiveRecord::Base
validates :title, :description, presence: true
validates_uniqueness_of :title
scope :order_by_position, ->{ all.order(:position) }
mount_uploader :image, ProductImageUploader
end
|
class User < ApplicationRecord
has_many :user_concerns
has_many :concerns, through: :user_concerns
has_many :goals
has_secure_password
validates :password, length: { in: 6..20 }
validates :username, uniqueness: true
end
|
Rails.application.routes.draw do
scope 'rest' do
post 'verify_user/:email', to: 'user#verify' #, constraints: { format: 'json' }
end
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
|
module Gradebook
module Reports
module TemplateHelper
def report
@report
end
def settings
@settings
end
def report_template
@report_template
end
def report_model_obj
@report_model_obj
end
def planner_repor... |
class SearchController < ApplicationController
layout 'application'
def index
@page_title = "Club Directory"
@site_section = "hub"
@query = params[:search]
@club = []
if (@tagList = Tag.find(:all, :conditions => ['name LIKE ?', "%#{@query}%"], :order => "name"))
@tagList.each do |tag|
(Clu... |
# frozen_string_literal: true
require 'rails_helper'
describe 'フロント画面:カテゴリ検索', type: :system do
context 'ログインしているとき' do
let!(:category1) { FactoryBot.create(:category, company: login_user.company) }
let!(:category2) { FactoryBot.create(:category) }
before do
sign_in_as(login_user)
visit com... |
require 'maws/command'
require 'maws/volumes_command'
require 'terminal-table/import'
class VolumesCleanup < VolumesCommand
def description
"volumes-cleaned - delete unattached EBS volumes for specified roles"
end
def run!
super
unattached = instances.specified.ebs.matching(:attached? => false)
... |
# encoding: utf-8
require 'curb'
class ProgrammeTV
def wday_from_label(label)
['dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi'].index(label).to_i
end
def channel_id_from_name(name)
['0', 'tf1', 'france2', 'france3', 'canalplus', 'france5', 'm6', 'arte', 'direct8', 'w9', 't... |
# == Schema Information
#
# Table name: double_rates
#
# id :integer not null, primary key
# week_day :integer
# begin_time :integer
# end_time :integer
# organization_id :integer
# worker_id :integer
# day :date
# rate :float
# created_at ... |
class CreateOrderEntries < ActiveRecord::Migration[6.1]
def change
create_table :order_entries do |t|
t.references :product
t.references :order
t.integer :units_bought
t.float :total_unit_price
t.timestamps
end
end
end
|
# frozen_string_literal: true
require 'sample_agent_test_configuration'
require 'statistical_arbitrage/shared_context'
describe StatisticalArbitrage::CointegrationTrader do
include_context 'utils for statistical arbitrage'
describe '#process_tick' do
it 'open :buy_aud position if the spread is lower than sd'... |
module DokkuCli
class Cli < Thor
desc "ps", "List processes running in app container(s)"
def ps
run_command "ps #{app_name}"
end
desc "ps:rebuild", "Rebuild the app"
def ps_rebuild
run_command "ps:rebuild #{app_name}"
end
desc "ps:restart", "Restart the app container"
de... |
FactoryGirl.define do
factory :document do
association :employee
association :document_template
sequence(:name) { |n| "document_#{n}" }
body "# Heading\nMarkdown body"
processing false
trait :processing do
processing true
end
trait :unsigned do
association :document_templ... |
class PrepSessionsController < ActionController::Base
def index
@prep_sessions = PrepSession.all
end
def show
@prep_session = PrepSession.find(params[:id])
end
def destroy_session_data
@prep_session = PrepSession.destroy_session_data(params[:id])
flash[:danger] = "Session and related data d... |
class Bs::Backend::UsersController < Bs::BackendController
before_action :auth_action
before_action :users_pagecontext
before_action :find_user, only: [:show, :edit, :update, :destroy]
def new
pagecontext(t('backend.pages.users.new.title'))
@user = Bs::User.new
end
def create
@user = Bs::User... |
class Admins::MasterScenariosController < Admins::ApplicationController
before_filter :find_master_scenario, :only => [ :show, :edit, :clone, :update, :destroy ]
cache_sweeper :master_scenario_sweeper, :only => [ :create, :update, :clone, :destroy ]
caches_action :index,
:cache_path => pro... |
cask :v1 => 'makemkv' do
version '1.9.0'
sha256 'd7889b105ad7ef29c69a255279b129a8555c0101875e353431b6eb50b48dc222'
url "http://www.makemkv.com/download/makemkv_v#{version}_osx.dmg"
homepage 'http://www.makemkv.com/'
license :unknown # todo: change license and remove this comment; ':unknown' is a machine-g... |
#!/usr/bin/env ruby
require './microtest'
def solve(input)
players = parse(input)
die = DeterministicDie::new
play(players, die)
# Assume 2 players
loser = players[0].score < players[1].score ? players[0] : players[1]
loser.score * die.num_rolls
end
class Player
attr_reader :pos, :score
def initialize(initi... |
class AddMissingColsToUsers < ActiveRecord::Migration
def change
add_column :users, :gender, :integer
add_column :users, :address, :string
add_column :users, :city, :string
add_column :users, :notified, :boolean, default: false
add_column :users, :pincode, :string
end
end
|
# Source: https://launchschool.com/exercises/ae82edb6
def ascii_value(str_in)
str_in.chars.map(&:ord).sum
end
# P:
# Question:
# Write a method that determines and returns the ASCII string value of a
# string that is passed in as an argument.
# Rules/Reqs:
# ASCII value of a string is the sum of ASC... |
#To get the configuration testing in this class for the
# config class
require 'spec_helper'
describe "scalr::config" do
context 'The apache2 file source' do
it { should contain_file('/etc/apache2/apache2.conf').with_ensure('file') }
#it { should contain_file('/etc/apache2/apache2.conf').with_c... |
require 'rails_helper'
shared_examples "all user show_category" do
it "has book_title content" do
expect(rendered).to have_content(category.category_name)
end
it "has link to categories_path" do
expect(rendered).to have_link('Back', href: categories_path)
end
end
RSpec.describe "categories/show", ty... |
class SiteConfig < ActiveRecord::Base
def self.get(key)
SiteConfig.find_by_key(key).value
end
end
|
# This page is only loaded when a user is denied access to the Resque Dashboard. It uses CanCan's authorize to display a flash message to inform the user they were denied access.
class QueuesController < ApplicationController
include Worthwhile::ThemedLayoutController
with_themed_layout '1_column'
def show
... |
require 'fileutils'
require 'pathname'
class ExampleFromDirectory
SCRIPT_EXT, INPUT_EXT = '.tst', '.vm'
PENDING_FILENAME = '.pending'
def initialize(pathname)
self.pathname = pathname
end
def input_pathnames
Pathname.glob(pathname + "*#{INPUT_EXT}")
end
def output_pathname
pathname + outpu... |
class AddFrogRefToTadpoles < ActiveRecord::Migration
def change
add_column :tadpoles, :frogs, :reference
end
end
|
require 'rails_helper'
describe 'Restaurant Features' do
context 'restaurants' do
it 'should have no restaurants' do
visit '/restaurants'
expect(page).to have_content 'No restaurants yet'
expect(page).to have_link 'Add a restaurant'
end
context 'restaurants have been added' do
before do
Restaur... |
class Rooms::Index < Rooms::Base
def fetch_result
res = BaseRoomJoin.where(base_room_id: base_rooms.ids).
eager_load(:base_room).preload(:target)
res = res.where(target_type: model_class.to_s) unless all_model?
res.map(&:target)
end
private
def base_rooms
return @base_rooms if defi... |
class AddSolvatioAndEinsteinToQuestion < ActiveRecord::Migration
def change
add_column :questions, :solvatio_used, :boolean
add_column :questions, :einstein_used, :boolean
end
end
|
# Generate a JavaClass::ClassList, which contains all class
# names with version numbers when introduced. The list is created
# iterating all JDKs, opening the RT.jars and loading all classes.
# Author:: Peter Kofler
# Copyright:: Copyright (c) 2009, Peter Kofler.
# License:: {BSD License}... |
class CreateMailingAddresses < ActiveRecord::Migration
def change
create_table :mailing_addresses do |t|
t.integer :customer_id
t.address
t.timestamps null: false
end
end
end
|
class Category < ApplicationRecord
validates_presence_of :name
has_many :restaurants
end
|
# require "./lib/current_taxis_collection"
# describe CurrentTaxisCollection do
# subject(:ctc) { CurrentTaxisCollection.new }
# describe "#all" do
# context "two taxis" do
# before do
# ctc.add(current1)
# ctc.add(current2)
# end
# let(:driver1) { Driver.new("Bill Smith", "m... |
class PagesController < ApplicationController
before_action :get_page, only: [:show, :edit, :update, :destroy]
before_action :get_sidebar, only: [:show, :index]
def index
if params[:go_to_page]
redirect_to action: "show", id: to_wikititle(params[:go_to_page])
end
end
def new
title = params... |
Sequel.migration do
up do
create_table(:prestaciones) do
primary_key :id
String :name
Integer :cost
end
end
down do
drop_table(:prestaciones)
end
end
|
class UsersController < ApplicationController
before_action :baria_user, only:[:edit, :update]
def show
@user = User.find(params[:id])
@book = Book.new
#@books = Book.where(user_id: @user).includes(:user).order("created_at DESC")
@books = @user.books
end
def edit
@user = User.find(param... |
class CreateEvents < ActiveRecord::Migration
def self.up
create_table :events do |t|
t.integer :ev_author
t.string :ev_text
t.date :ev_date
t.integer :cell_sked_id
t.integer :group_id
t.integer :ev_recipient
t.timestamps
end
end
def self.down
BusInf_table :e... |
#!/usr/bin/ruby
#
require_relative '../../panthage_utils'
require_relative '../../models/panthage_cmdline'
require_relative '../../xcode_proj/models/panthage_xc_scheme_model'
module CommandHelper
def self.find_and_open_xcode_project(current_dir, config, platform)
nil unless File.exist? current_dir
all_fil... |
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{rspec_multi_matchers}
s.version = "1.0.2"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Greg Weber"]
s.date = %q{2008-12-09}
s.description = %q{* match_each * match_e... |
class HashUtils
class << self
def hash_to_open_struct(data_hash)
elements_with_hash_values = data_hash.select { |key, value| value.is_a? Hash }
return OpenStruct.new(data_hash) if elements_with_hash_values.empty?
result = OpenStruct.new(data_hash.select { |key, value| !value.is_a?(Hash) })
... |
describe "#largest_phone_number" do
it "doesn't change the original array of phone numbers" do
numbers = ['123-456-7777', '963-481-7945', '111-222-3333']
largest_phone_number(numbers)
expect(numbers).to eq(numbers)
end
it "finds the largest number with only dashes" do
numbers = ['123-456-7777', '... |
class CreateUsermanagementFamilyviews < ActiveRecord::Migration
def change
create_table :usermanagement_familyviews do |t|
t.belongs_to :account, index: true
t.belongs_to :person, index: true
t.boolean :active, null: false, default: false
t.timestamps null: false
end
add_foreign_ke... |
# == Schema Information
#
# Table name: groups
#
# id :integer not null, primary key
# name :string(255)
# address :string(255)
# time :string(255)
# created_at :datetime
# updated_at :datetime
# picture :string(255)
# twitter :string(255)
# latitude :float
# longitude ... |
class User < ActiveRecord::Base
validates :name, presence: true
validates :email, presence: true, uniqueness: true
validates :password, presence: true
has_many :stories
has_many :comments
has_many :likes
end
|
class IdentityType < ActiveRecord::Base
has_many :document_identities
include HasValueField
default_value_method :publisher, :submitter
end
|
# Method name: count_in_list(list, item_to_count)
# Inputs: 1. a list of anything, 2. an item for us to count in the list
# Returns: The number of times our item is contained in the input list
# Prints: Nothing
#
# For example,
# count_in_list([1,2,3], 1) == 1
# count_in_list([1,2,3], -1) == 0
# co... |
require 'test_helper'
class DebtPapersControllerTest < ActionController::TestCase
setup do
@debt_paper = debt_papers(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:debt_papers)
end
test "should get new" do
get :new
assert_response :s... |
class KMeansClustering
class Cluster
def initialize(centroid, dataset)
@centroid = centroid
@dataset = dataset
end
def update_centroid
centroid_hash = Hash.new(0)
@dataset.each do |data|
data.dimensions.each do |dimension, value|
centroid_hash[dimension] += valu... |
module PriorityTest
module RSpec2
module ExampleSorter
def self.sort(example1, example2)
element1 = PriorityTest::Core::PrioritySortElement.new(example1.full_description)
element2 = PriorityTest::Core::PrioritySortElement.new(example2.full_description)
element1 <=> element2
en... |
require './tiles.rb'
class Board
attr_accessor :board
def initialize(sidelength, mines)
@sidelength = sidelength
@mines = mines
self.build
end
def neighbors(tile)
neighbors = []
relatives = [
[-1, 1], [0, 1], [1, 1],
[-1, 0], [1, 0],
[-1, -1], [0, -1], [1, -1]
... |
require 'bigdecimal'
module Simplepay
module Support
##
# Amazon often represents dollar values as a combination of a value and a
# currency. In several types of requests, the combination is required for
# communication.
#
# At the present time, Amazon only uses USD.
#
class ... |
class GoogleService < ApiService
def initialize(params)
super
@google_client = GooglePlaces::Client.new(ENV['GOOGLE_PLACES_KEY'])
end
def search
begin
results = @google_client.spots(@latitude.to_f, @longitude.to_f,:name => @term, :types => 'restaurant', :radius => @radius)
map_results(re... |
# Write a method that displays a 4-pointed diamond in an n x n grid, where n is an odd integer that is supplied as an argument to the method. You may assume that the argument will always be an odd integer.
=begin
Algorithm
set distance from center
use method to print first line to midline inclusive --> grid, distance
... |
class AddIndex3ToAdditionalSubjects < ActiveRecord::Migration
def change
add_index :additional_subjects, [:academic_id, :subject], unique: true
end
end
|
require 'spec_helper'
RSpec.describe Pretentious::Deconstructor do
before do
@fixture = Pretentious::Deconstructor.new
end
describe "#build_tree" do
it "should decompose an object" do
message = 'test'
another_object = Pretentious.watch {
TestClass1.new(message)
}
# Prete... |
# frozen_string_literal: true
describe Zafira::Models::User do
describe 'CONSTANTS' do
describe 'Type' do
let(:constant) { Zafira::Models::User::Type }
describe 'RUN_OWNER' do
it { expect(constant::RUN_OWNER).to eq(:run_owner) }
end
describe 'TEST_SUITE_OWNER' do
it { ex... |
Rails.application.routes.draw do
root to: 'messages#index'
get "users/verify", to: 'users#show_verify', as: 'verify'
post "users/verify"
post "users/resend"
resources :users, except: [:index]
resources :messages, only: [:index, :show]
get 'sessions/new' => 'sessions#new'
post 'sessions' => 'sessio... |
class ForeignOrganizationsController < ApplicationController
def index
@organizations = Organization.foreign # see Organization model for scope
render :index
end
end
|
require 'open-uri'
require 'securerandom'
require 'fileutils'
require_relative './data_store.rb'
class PhotoHelper
def get_random_photo(options={})
physical_photos = get_photos(options)
virtual_photos = options[:datastore].get_photos(options[:dir])
count = physical_photos.count
count += virtual_pho... |
require_relative 'my_crawler_init'
require 'rspec'
require 'nokogiri'
describe 'MyCrawler' do
let(:root_page_path) { 'http://root.com' }
let(:inner_page1_path) { 'http://root/sub_page1.com' }
let(:inner_page2_path) { 'http://root/sub_page2.com' }
let(:inner_page3_path) { 'http://root/sub_page3.com' }
let(... |
require 'rails_helper'
RSpec.describe QuestionsController, type: :controller do
let!(:user) {User.create!(name: 'VanVan',location: 'Cuba',username: 'aquinomas',password: 'aquinomas')}
let!(:question) {Question.create!(title: "Test title", body: "Test body", user: user)}
describe "GET #index" do
it "assigns ... |
require "rails_helper"
describe Scheduler::Schedule do
before do
availability = create(:availability,
start_at: Time.zone.now.change(usec: 0),
end_at: 1.week.from_now.change(usec: 0))
@schedule = Scheduler::Schedule.new(availability: availability).to_hash
... |
class DatesController < ApplicationController
def show
@labels_with_tasks = Label.with_current_tasks_for_user(@current_user, @start_time, @end_time)
respond_to do |format|
format.html { render "dates/show" }
end
end
end |
class AddMissingIndexes < ActiveRecord::Migration
def change
add_index :sections, :category_id
add_index :treatments, :category_id
end
end
|
require 'fileutils'
require 'colorize'
require 'compass'
class CssDir2
def initialize(css_dir, css_dir2)
puts "cssDir2 is now running...".green
Compass.configuration.on_stylesheet_saved do |file|
if File.exists?(file)
directory = File.dirname(file) + "/" + css_dir2 + "/... |
# copied from /app/models/news.rb
class Blog < ActiveRecord::Base
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
has_many :comments, :as => :commented, :dependent => :delete_all, :order => "created_on"
acts_as_taggable
validates_presence_of :title, :description
validates_length_of :t... |
require 'test_helper'
class GroupMeTest < Test::Unit::TestCase
def setup
@stub_token = stub
@mock_uri = mock
@stub_request = stub
@stub_response = stub
@mock_headers = mock
end
def test_get_group
@mock_headers.tap { |m| m.expects(:merge!).with("X-Access-Token" => @stub_token) }
Group... |
class Photo < ActiveRecord::Base
belongs_to :user
attr_accessible :file, :name, :url, :content
mount_uploader :file, ImageUploader
validates :name, presence: true, length: { :maximum => 255 }
end
|
class PersonWorker
include Sidekiq::Worker
sidekiq_options retry: false
def perform(person_id)
person = Person.find(person_id)
person.remote_photo_url = person.return_url
person.images.each do |image|
person.remote_photo_url = image.return_url
image.save!
end
person.processed_im... |
module TaskSupport
class Importer
HOST = 'http://api.cbssports.com'.freeze
PATH = 'fantasy/players/list?version=3.0&response_format=JSON&SPORT='
def initialize(
league,
conn=Faraday.new(HOST),
sport_fetcher=SportFetcher.new,
deserializer=Deserializer.new
)
@league = leag... |
class RoomBooking < Booking
validates_presence_of :end_date
end
|
#!/usr/bin/env ruby
require 'fileutils'
require 'pathname'
require 'tmpdir'
require 'octokit'
BUILD_SH = Pathname(__FILE__).+('../../build.sh').expand_path
VERSION = `sh '#{BUILD_SH}' get-version`.strip
RELEASE = "v#{VERSION}"
BUILD = BUILD_SH.parent + 'build'
OBJC_ZIP = BUILD + "realm-objc-#{VERSION}.zip"
SWIFT_ZI... |
# Write a method that takes a single String argument and returns a new string that contains the original value of the argument with the first character of every word capitalized and all other letters lowercase.
# You may assume that words are any sequence of non-blank characters.
def word_cap(string)
words_array = ... |
# == Schema Information
# Schema version: 20090906153511
#
# Table name: user_team_drivers
#
# id :integer not null, primary key
# user_id :integer
# driver_id :integer
# created_at :datetime
# updated_at :datetime
#
class UserTeamDriver < ActiveRecord::Base
belongs_to :user
belongs_to :dr... |
class ProductRequest < ActiveRecord::Base
belongs_to :product, counter_cache: true
belongs_to :user
has_drafts
validates :product, :user, presence: true
validates_uniqueness_of :user_id, scope: :product_id
def name
product.name
end
end
|
class NewsStory < ActiveRecord::Base
self.table_name = 'news_story'
outpost_model
has_secretary
include Concern::Scopes::SinceScope
include Concern::Scopes::PublishedScope
include Concern::Associations::ContentAlarmAssociation
include Concern::Associations::AudioAssociation
include Concern::Association... |
require 'test_helper'
class ShopModelTest < ActiveSupport::TestCase
def setup
@shop = Shop.create(name: " ")
end
test "shop name must not be empty" do
assert_not @shop.valid?
end
end
|
require "rails_helper"
describe ExaminersController do
describe "routing" do
it "routes to #index" do
expect(get("/examiners")).to route_to("examiners#index")
end
it "routes to #new" do
expect(get("/examiners/new")).to route_to("examiners#new")
end
it "routes to #show" do
exp... |
require 'rails_helper'
include CamaleonCms::Frontend::ApplicationHelper
RSpec.describe 'PostDecorator' do
init_site
it 'next and previous post related to post type' do
post_type = create(:post_type, slug: 'test-post-type', site: @site)
post3 = create(:post, post_type: post_type, slug: 'test3', post_order: 3... |
module Omniship #:nodoc:
class Error < StandardError
end
class ResponseError < Error
attr_reader :response
def initialize(response = nil)
if response.is_a? Response
super(response.message)
@response = response
else
super(response)
end
end
end
class Resp... |
FactoryBot.define do
factory :facility do
name { Faker::Lorem.word }
code { Faker::Number.number(2) }
trait :flower_only do
site_license { Faker::Address.country }
timezone { TZInfo::Timezone.all.sample.name }
is_complete { true }
address { build(:address) }
rooms do
... |
class Rating < ActiveRecord::Base
attr_accessible :rating, :movie_id, :user_id
belongs_to :movie
belongs_to :user
end |
class CadastrarPage < SitePrism::Page
#Esse comando esta setando a url que sera utilizada na automação
set_url 'https://automacaocombatista.herokuapp.com/'
#Esse lista de elemento abaixo e o que sera utilizado na automação
element :comecarautomacao, :xpath, '//*[@id="index-banner"]/div/div[3]/a'
element ... |
# Login to MyAmaysim Account
# --------------------------
Given(/^a valid MyAmaysim user logs into his account$/) do
visit LoginPage
on(LoginPage).login
on(DashboardPage).close_welcome_popup
expect(@browser.url).to eq(FigNewton.amaysim_dashboard)
end
Then(/^the user can log out of his account$/) do
... |
# frozen_string_literal: true
require 'simplecov'
SimpleCov.start
require 'sidekiq/limit_fetch'
if Sidekiq::LimitFetch.post_7?
Sidekiq.configure_embed do |config|
config.logger = nil
end
else
Sidekiq.logger = nil
Sidekiq.redis = { namespace: ENV.fetch('namespace', nil) }
end
RSpec.configure do |config|
... |
class AddPositionAndGoodAtToAnchors < ActiveRecord::Migration
def change
add_column :anchors, :position, :string
add_column :anchors, :good_at, :string
end
end
|
require 'rails_helper'
RSpec.describe 'Shorten Url features' do
feature "Security" do
# let!(:url) { create(:shorten_url, original_url: "https://facebook.com") }
after(:all) do
DatabaseCleaner.clean_with(:truncation)
end
short = ShortenUrl.create(original_url: 'https://google.com')
it "... |
module CopyPeste
class Command
module SetAnalysisModOptions
# Allows a user to configure available options of a loaded analysis module
# before being executed.
#
# @return [Boolean] True if the cmd_return methods succeeds, false otherwise
def run
if @core_state.analysis_modu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.