text stringlengths 10 2.61M |
|---|
# -*- encoding: utf-8 -*-
class AprovaFacil
class CartaoCredito
module Bandeira
VISA = 'VISA'
MASTERCARD = 'MASTERCARD'
DINERS = 'DINERS'
AMEX = 'AMEX'
HIPERCARD = 'HIPERCARD'
JCB = 'JCB'
SOROCRED = 'SOROCRED'
AURA = 'AURA'
end... |
require 'date'
################################ INITIALIZATION FOR OBJECTS ################################
# log every kind of message
FILE_TIMESTAMP = DateTime.now.to_time.to_i
$log_file_open = false
def log_everything msg, is_debug = false
Thread.start{
# dunno what is a better way but this will make text in ... |
class CreateResumes < ActiveRecord::Migration[5.1]
def change
create_table :resumes do |t|
t.string :first_name
t.string :last_name
t.string :country
t.string :city
t.text :contact_information
t.string :phone
t.string :degree
t.string :school
t.string :field_o... |
class RegisterUserCommand
include ActiveModel::Model
include ActiveEvent::Command
form_name 'User'
attributes :id, :name, :vorname, :email, :benutzername, :passwort, :typ, :shash
end
|
# require 'rubygems'
require 'twitter'
require 'byebug'
require 'rest-client'
require 'json'
require 'open-uri'
require 'json'
require './helpers/api_twit_helper'
require 'cronedit'
PATH = './credentials.md'
LONDON = 44418
PATH_TRENDS = './data/trends/'
PATH_TWEETS = './data/tweets/tweets/'
PATH_TWEETS_TEXT = './data/... |
require 'spec_helper'
class Vigil
describe System do
describe '#system' do
it do
subject.system("true").should be_true
end
context 'when it fails' do
it 'should raise an error' do
sys = System.new
expect {
sys.system('false')
}.to rais... |
require 'spec_helper'
describe Mongoid::History do
it { is_expected.to respond_to(:trackable_settings) }
it { is_expected.to respond_to(:trackable_settings=) }
describe '#default_settings' do
let(:default_settings) { { paranoia_field: 'deleted_at' } }
it { expect(described_class.default_settings).to eq(... |
class AddSpotToEntries < ActiveRecord::Migration
def change
add_column :entries, :surf_spot, :string
end
end
|
class Task < ActiveRecord::Base
include IceCube
belongs_to :website
belongs_to :category
serialize :recurrence
has_many :enrollments
has_and_belongs_to_many :roles
has_and_belongs_to_many :exclusions
validates_presence_of [:title, :start_time, :start_date]
include RecurrenceAccessor
recurrence_acc... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'open3'
Vagrant.configure('2') do |config|
config.vm.box = 'centos/7'
config.vm.box_version = '1902.01'
config.vm.provider 'virtualbox' do |v|
v.linked_clone = true
v.customize ['modifyvm', :id, '--audio', 'none']
end
config.vm.synced_folder '.', '/... |
# == Schema Information
#
# Table name: stadiums
#
# id :integer not null, primary key
# user_id :integer
# category_id :integer
# name :string default("Без названия"), not null
# phone :string
# description :string
# address :string
# latitude :float
# longi... |
# == Schema Information
#
# Table name: events
#
# id :integer not null, primary key
# name :string
# end_time :string
# summary :text
# image_url :string
# created_at :datetime not null
# updated_at ... |
# frozen_string_literal: true
class NotificationRelayJob < ApplicationJob
queue_as :default
def perform(recipients, actor, action, notifiable)
recipients.each do |recipient|
Notification.create(recipient: recipient,
actor: actor,
action: action,
... |
class Runner
class SolutionFound < RuntimeError; end
def initialize(date, logger: StringIO.new)
@date = date
@logger = logger
end
def execute!(input, part: nil, **overrides)
@part_number = part
read, write = IO.pipe
Process.wait(fork do
read.close
@solutions = []
overrid... |
class ChangeStartTimeNameOnEvents < ActiveRecord::Migration
def change
rename_column :events, :start_time, :time
end
end
|
class LibrarySubj < ActiveRecord::Base
# Scopes
default_scope { where(active: true) }
# Relations
has_and_belongs_to_many :library_cats, join_table: :library_cats_subjs
Reusable.has_many_translations(self)
def name
# Returns the library_subj_name for the current locale
translation = "library_subj_... |
require 'rubygems'
require './spec_helper'
require 'stringio'
require 'open3'
describe Gem::Commands::SpecificInstallCommand do
before do
module Kernel
alias_method :real_system, :system
def system(cmd)
'system "#{cmd}"'
end
def puts(cmd)
cmd
end
end
end
a... |
require File.expand_path('../../helper.rb', File.dirname(__FILE__))
describe WebkitRemote::Client::JsObject do
before :each do
@client = WebkitRemote.local port: 9669
@client.page_events = true
@client.navigate_to fixture_url(:runtime)
@client.wait_for type: WebkitRemote::Event::PageLoaded
end
af... |
class Cart
attr_reader :contents
def initialize(contents)
@contents = contents || {}
@contents.default = 0
end
def add_item(item_id)
@contents[item_id] += 1
end
def less_item(item_id)
@contents[item_id] -= 1
end
def count
@contents.values.sum
end
def items
@contents.map ... |
puts "Basic testing with Test::Unit -----------------------"
# Test::Unit is a standard Ruby library for unit testing
require 'test/unit/assertions'
include Test::Unit::Assertions
hello = "Hello World!"
assert_equal 'Hello World!', hello, "function should return 'Hello World!'"
pass = true
assert pass, "Test should... |
module VideoStore
class Customer
attr_reader :name
def initialize(name)
@name = name
@rentals = []
end
def add_rental(arg)
@rentals << arg
end
def statement
[ @rentals.inject(0) { |sum, rental| sum + rental.charge },
@rentals.inject(0) { |sum, rental| sum + r... |
class E9Crm::DatedCostsController < E9Crm::ResourcesController
belongs_to :advertising_campaign, :optional => true
defaults :resource_class => DatedCost
include E9Rails::Controllers::Orderable
self.should_paginate_index = true
filter_access_to :bulk_create, :require => :create, :context => :admin
prepend... |
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
include TagsHelper
def pipe_spacer
'<span class="pipe">|</span>'
end
def tab_selected?(current_tab, tab_name)
current_tab == tab_name ? "selected" : ''
end
def sub_tab_selected?(current_... |
class Registration < ApplicationRecord
has_many :tests, dependent: :destroy
belongs_to :user
belongs_to :subject
end
|
class CreateBookContributors < ActiveRecord::Migration
def change
create_table :book_contributors do |t|
t.integer :book_id, null: false
t.integer :book_role_id, null: false
t.integer :contributor_id, null: false
t.integer :position, default: 0
t.timestamps null: false... |
class Ingredient < ActiveRecord::Base
belongs_to :recipe
validates :name, uniqueness: true
validates :quantity, uniqueness: true
end
|
Then (/^I check form was uploaded$/) do
was_upload_success = system("python3 commcare-hq-api/utils.py assert_newer_form")
if not was_upload_success
fail("No new form submission since last check")
end
end
Then (/^I store most recent form submission time$/) do
system("python3 commcare-hq-api/utils.py store_l... |
module MedicalEntities
class DashboardController < ApplicationController
def index
@donations = current_medical_entity.donations
end
end
end
|
class RecipesController < ApplicationController
def index
@recipe_hash = {}
Recipe.all.each do |recipe|
@recipe_hash[recipe] = recipe.ingredients.length
end
end
def show
@recipe = Recipe.find(params[:id])
end
def new
@recipe = Recipe.new
@users = User.all
end
def create
... |
FactoryGirl.define do
factory :admin do
name 'Admin Name'
email 'admin_first@admin.admin'
password '123456789'
type 'Admin'
creator Admin.first
creator_type 'Admin'
factory :admin_with_created_tickets do
transient do
tickets_count 5
end
after(:create) do |admin, e... |
FactoryGirl.define do
factory :activity do
association :user
trait :blog do
association :trackable, :factory => :blog
end
trait :review do
association :trackable, :factory => :review
end
trait :recipe do
association :trackable, :factory => :recipe
end
trait :c... |
class OfficerDatatable < ApplicationDatatable
def view_columns
# Declare strings in this format: ModelName.column_name
# or in aliased_join_table.column_name format
@view_columns ||= {
employee_id: {source: "Officer.employee_id", cond: :eq},
badge: {source: "Officer.badge", searchable: false},... |
Rails.application.routes.draw do
root 'boards#index'
resources :boards do
collection do
get '/:board_id/like' => 'boards#user_like_board', as: :user_like
get '/page_scroll' => 'boards#page_scroll', as: :scroll
end
member do
post '/comments' => 'boards#create_comment', as: :create_c... |
class AddImageBinaryToEvent < ActiveRecord::Migration
def change
add_column :events, :image_binary, :binary
end
end
|
#! /usr/bin/env ruby
require 'trollop'
require 'vigil'
require 'toml'
opts = Trollop::options do
opt :rcfile, "Path to the configuration file"
end
Vigil.new(opts).start
|
module Brightbox
class ErrorParser
include Brightbox::Logging
attr_accessor :socket_error, :token_error
def initialize(socket_error)
@socket_error = socket_error
end
def pretty_print
case socket_error
when Excon::Errors::ServiceUnavailable
error "Api currently unavailab... |
require 'tempfile'
class Screenplay
class Host
class FileSystemObject
attr_reader :path
def initialize(path, ssh, &result_block)
@path = path
@ssh = ssh
@result_block = result_block
end
def file?
cmd = "[ -f #{@path} ]"
result = @ssh.run(cmd)
... |
module Belafonte
module Helpers
module Flags
def switches
@switches ||= {}
end
def switch_active?(switch)
switches[switch]
end
def options
@options ||= {}
end
def option(option)
options[option]
end
end
end
end
|
name = 'Belle'
age = 29
height = 64
weight = 144
eyes = 'Brown'
teeth = 'White'
hair = 'Brown'
puts "Let's talk about #{name}."
puts "She's #{height} inches tall."
puts "She's #{weight} lbs."
puts "Actually that's not too heavy."
puts "She's got #{eyes} eyes and #{hair} hair."
puts "Her teeth are usually #{teeth} depe... |
class PasswordController < ApplicationController
def check
@username = params[:username] unless params[:username].nil?
@password = params[:password] unless params[:password].nil?
special = "?<>',?[]}{=-)(*&^%$#`~{}."
regex = /[#{special.gsub(/./){|char| "\\#{char}"}}]/
if !@username || !@password
... |
# frozen_string_literal: true
RSpec.describe Api::V1::Admin::Users::ShowAction do
let!(:user) { create(:user) }
let!(:current_user) { create(:user, :admin) }
let(:action) { described_class.new(context: {current_user: current_user}) }
describe '#call' do
subject(:call) do
action.call(input)
end
... |
# A Module to store code I frequently use for killing stuff, either by pid or
# by caption.
#
# Author: Ben Nagy
# Copyright: Copyright (c) Ben Nagy, 2006-2013.
# License: The MIT License
# (See http://www.opensource.org/licenses/mit-license.php for details.)
require_relative 'toolhelp'
require 'ffi'
module BM3
mod... |
require_all 'lib'
class CLI
def self.start
Scraper.create_games_with_hash
puts "Would you like to view upcoming video game releases?"
choice = gets.strip.downcase
if choice.include?("y")
begin
puts "How would you like to view upcoming video game releases?"
puts "All | By Titl... |
source 'https://rubygems.org'
ruby '2.4.1'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.1'
# Use sqlite3 as the database for Act... |
# frozen_string_literal: true
class LandingPageController < ApplicationController
def index
campaigns if current_user&.designer? || current_user&.content_creator?
@corporations = Corporation.all
@companies = Company.all
if !current_user
render layout: 'landing_page'
else
render layou... |
require 'rails_helper'
RSpec.describe "configurations/show", type: :view do
before(:each) do
@configuration = assign(:configuration, Configuration.create!(
:config_key => "Config Key",
:config_value => "Config Value",
:unit => "Unit"
))
end
it "renders attributes in <p>" do
render
... |
module Shops::Admin::ItemHelper
COLORS_GROUP = %w(primary success info warning danger default)
def new_step1_shopitems_path(*args)
new_step1_shop_admin_items_path(*args)
end
def new_step2_shopitems_path(*args)
with_category_shop_admin_items_path(*args)
end
def property_edit(object, property)
... |
# encoding: UTF-8
# Copyright 2012 Twitter, Inc
# http://www.apache.org/licenses/LICENSE-2.0
module TwitterCldr
module Collation
# Trie that delegates all not found keys to the fallback.
#
# Note: methods #get and #find_prefix have a bit different behavior. The first one, #get, delegates to the fallbac... |
module TradeEvent
module Mappable
def self.included(klass)
klass.settings = {
index: {
analysis: {
analyzer: { custom_analyzer: { type: 'custom',
tokenizer: 'standard',
filter: %w(stan... |
module FormsHelper
def define_form
if defined?(@form)
@form = @form
else
@form = Form.new
end
end
def reload_application_js
if @form.errors.any?
end
end
end
|
require 'spec_helper'
describe Spree::VolumePrice do
it { should belong_to(:variant) }
it { should validate_presence_of(:variant) }
it { should validate_presence_of(:amount) }
before(:each) do
@volume_price = Spree::VolumePrice.new(:variant => Spree::Variant.new, :amount => 10, :discount_type => 'price')
... |
# frozen_string_literal: true
# == Schema Information
#
# Table name: nippos
#
# id :integer not null, primary key
# user_id :integer not null
# reported_for :date not null
# subject :text(65535)
# body :text(65535)
# sent_at :datetime
# created_at ... |
class User < ActiveRecord::Base
has_secure_password
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
validates :email, presence: true,
uniqueness: true,
format: { with: VALID_EMAIL_REGEX }
before_save :downcase_email
def downcase_email
self.email = email.downcase
end
end
|
class OfficialChallengesController < ApplicationController
include ApplicationHelper
# GET /official_challenges
# GET /official_challenges.json
def index
@official_challenges = OfficialChallenge.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @official_ch... |
class Api::V1::ShiftsController < ApplicationController
skip_before_filter :verify_authenticity_token, :only => [:update]
before_action :authenticate, except: [:index,:show]
before_action :set_shift, only: [:update,:destroy]
before_action :set_service, only: [:create]
before_action :set_user, only: [:create,:upda... |
class RemoveNumeroBrigadistasCommunities < ActiveRecord::Migration
def change
remove_column :communities, :Numero_Brigadistas
end
end
|
# GoogleScraps
module Feexus
module GoogleScraps #:nodoc:
def self.included(base)
base.extend ClassMethods
end
module ClassMethods
def google_scraps
include Feexus::GoogleScraps::InstanceMethods
extend Feexus::GoogleScraps::SingletonMethods
end
en... |
class Owner < ApplicationRecord
has_many :cats
end
|
require 'json'
require 'date'
require_relative "author"
require_relative "book"
require_relative "reader"
require_relative "order"
module Lib
class Library
def initialize(file='')
@books = []
@authors = []
@readers = []
@orders = []
load(file) if file != ''
end
def load(... |
class CreateSlips < ActiveRecord::Migration[5.0]
def change
create_table :slips do |t|
t.string :name
t.jsonb :slips, default: {
keywords: [],
mentions: [],
hashtags: []
}
t.integer :listener_id
t.bigint :tweet_id
t.string :author
t.string :b... |
# == Schema Information
#
# Table name: students
#
# id :integer not null, primary key
# major_id :integer
# first_name :string
# last_name :string
# graduation_date :date
# college_id :integer
# resume_link :string
# created_at :datetime
... |
require 'mechanize'
require 'nokogiri'
class AmazonSession
@@session_id = 0
@@recommendation_refreshes = 70
@@mozilla_agent = "Linux Mozilla"
@@amazon_home = "http://www.amazon.com"
@@wish_list_creation_url = "http://www.amazon.com/gp/registry/wishlist"
@@wish_list_url = "http://www.amazon.com/gp/registry/... |
class AddConfirmationToOrders < ActiveRecord::Migration[5.2]
def change
add_column :orders, :buyer_confirmation, :boolean
add_column :orders, :dressmaker_confirmation, :boolean
end
end
|
# Method name: run_length_encode
# Inputs: A String that has been "run-length encoded"
# Returns: The original string
# Prints: Nothing
# This takes a run-length encoded string and "reconstructs" the original string.
def run_length_decode(string)
result = ''
until string.length == 0
n = string.s... |
require 'webmock/rspec'
require_relative '../app/guarani_client'
require_relative '../app/models/course'
describe 'Guarani' do
def mock_get_request(guarani_url, response)
stub_request(:get, guarani_url)
.to_return(status: 200, body: response, headers: {})
end
def mock_post_request(guarani_url, body, r... |
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe Daggregator::Connection do
describe "uri_from" do
before(:each) do
Daggregator.configure do |c|
c.server = 'server'
c.port = '8000'
end
end
subject { Daggregator::Connection.new }
it "formats as... |
require 'spec_helper'
describe 'OmniAuth::Stratgies::ETrade' do
let(:access_token) { double('AccessToken', :options => {}) }
subject do
OmniAuth::Strategies::Etrade.new({})
end
before(:each) do
OmniAuth.config.test_mode = true
allow(subject).to receive(:access_token).and_return(acce... |
class GamesController < ApplicationController
before_filter :login_required, :only => [:your, :edit, :update]
before_filter :fetch_games, :only => [:index, :show, :other, :your, :new]
def index
@users = User.where("publicized_at is not null").order("publicized_at desc").limit(7)
@other_games = @other_gam... |
class LightsController < ApplicationController
before_action :set_light, only: [:show, :edit, :update, :destroy]
before_action :authenticate_user!, except: [:index, :show]
before_action :correct_user, only: [:edit, :update, :destroy]
# GET /lights
# GET /lights.json
def index
@lights = Light.all
end
... |
class EventsController < ApplicationController
before_action :set_event, only: [:show, :edit, :update, :destroy]
# GET /events
# GET /events.json
def index
# @events = current_user.events
@events = current_user.attendances.where("accepted IS TRUE").map(&:event).compact
@user_id = current_user.id
... |
# frozen_string_literal: true
require 'rainbow'
require 'subprocess'
module Puppler
# utility methods for logging and command execution
module Utils
def log_info(message)
puts Rainbow(message).color(:blue)
end
def log_fatal(message)
puts Rainbow(message).color(:red)
exit 1
end
... |
class AddProductFilters < ActiveRecord::Migration
def change
create_table :spree_product_filters do |t|
t.string :title
t.references :taxon
t.string :type
t.references :property
t.string :value_type
end
end
end
|
# frozen_string_literal: true
require "test_helper"
require "generators/boring/rubocop/install/install_generator"
class RubocopInstallGeneratorTest < Rails::Generators::TestCase
tests Boring::Rubocop::InstallGenerator
setup :build_app
teardown :teardown_app
include GeneratorHelper
include ActiveSupport::Te... |
require_relative 'input'
def preprocess_1(data)
# Instructions from the problem
data[1] = 12
data[2] = 2
data
end
def part_1
tape = preprocess_1(input).dup
tape
.each_slice(4)
.reduce(tape) do |acc, step|
case step[0]
when 1
acc[step[3]] = acc[step[1]] + acc[step[2]]
whe... |
#calculator project
#MVP= input and operations
puts "welcome to my calculator"
# ask for input 1
puts "Please give me your first number"
#Actually remember the input 1
number1 = gets.chomp.to_f
#"what operation would you like to use?" (add,subtract,multiple,divide)
loop do
puts "Would you like to plus,minu... |
require File.dirname(__FILE__) + '/spec_helper'
class MommyChicken < ActiveRecord::Base
has_many :little_chickens
dirty_associations :little_chickens
end
class LittleChicken < ActiveRecord::Base
end
describe MommyChicken do
before do
@mommy = MommyChicken.create(:name => "Gertrude")
@little_chickens_wa... |
class Cheval < ApplicationRecord
belongs_to :profile
belongs_to :robe
belongs_to :category
validates :name, presence: true, length: { maximum: 25 }
validates :description, presence: true, length: { maximum:2500 }
validates :taille, presence: true
has_many :profiles, through: :bookings
has_many :revie... |
require 'spec_helper'
describe Stormpath::Resource::ApiKey, :vcr do
let(:application) { test_application }
let(:tenant) { application.tenant }
let(:account) do
application.accounts.create(
email: 'test@example.com',
given_name: 'Ruby SDK',
password: 'P@$$w0rd',
surname: 'SDK'
)
... |
class StaticController < ApplicationController
before_action :authorized, only: [:auto_login]
def index
render json: { mesage: 'Welcome!' }
end
end
|
require_relative 'registracion_error'
class PlanInexistenteError < RegistracionError
def initialize(msg = 'El plan es inexistente')
super
end
end
|
class User < ActiveRecord::Base
has_secure_password
validates_uniqueness_of :name
has_many :entries, dependent: :destroy
has_many :comments, dependent: :destroy
validates_length_of :name, :maximum => 10
end
|
class CardTable < ActiveRecord::Migration
def change
create_table :cards do |t|
t.string :answer, :choice2, :choice3, :choice4
t.text :question
t.integer :deck_id
# t.references :deck
end
end
end
|
class RemoveSharedListFromSharedDocuments < ActiveRecord::Migration[6.0]
def change
remove_reference :shared_documents, :shared_list, null: false, foreign_key: true
end
end
|
class Category < ActiveRecord::Base
belongs_to :member
has_many :incomes, dependent: :destroy
has_many :expenses, dependent: :destroy
validates :title, uniqueness: {scope: :member_id}
validates :title, presence: true
validates :member_id, presence: true
# validates :description, presence: true
# validates :amoun... |
# == Schema Information
#
# Table name: posts
#
# id :integer not null, primary key
# link :string(255)
# owner_id :integer not null
# sub_id :integer
# created_at :datetime
# updated_at :datetime
# title :string(255) not null
#
class Post < ActiveRecord::Base
i... |
require 'spec_helper'
describe Mist::CodeExampleParser do
describe "with nil arg" do
subject { Mist::CodeExampleParser.new(nil).examples }
it { should have(0).examples }
end
describe "with text but no examples" do
subject { Mist::CodeExampleParser.new("this is text").examples }
it { should hav... |
class WorkDay < ActiveRecord::Base
attr_accessible :date
has_many :work_packages
end
|
Rails.application.routes.draw do
namespace :admins do
resources :products
resources :site_banners
put "/products/:id/show_state"=>"products#show_state",as: :products_show_state
post "/site/address_create" => "site#address_create"
get "/site/address_new" => "site#address_new"
get "/site... |
# Using the Card class from the previous exercise, create a Deck class that contains all of the standard 52 playing cards. The Deck class should provide a #draw method to deal one card. The Deck should be shuffled when it is initialized and, if it runs out of cards, it should reset itself by generating a new set of 52 ... |
require_dependency 'application_controller'
module Help
class ApplicationController < ApplicationController
protect_from_forgery with: :exception
before_action :breadcrumb
private
def breadcrumb
@breadcrumb_title = 'Helpdesk'
@breadcrumb_description ||= 'Módulo de gestão de chamados'
... |
module Mission
class LaunchStage
attr_reader :stage_name, :is_final, :transitions
def initialize(stage_name, transitions, is_final = false)
@stage_name = stage_name
@transitions = transitions
@is_final = is_final
end
end
end
|
class AddDirectorsToMovie < ActiveRecord::Migration[5.0]
def change
add_column :movies, :director, :string, comment: "导演名称"
add_column :movies, :introduce, :string, comment: "电影简介"
end
end
|
class UsersBaseController < ApplicationController
before_filter :redirect_to_another_installation
private
def redirect_to_another_installation
return unless ENV["REDIRECT_TO_OTHER_REMIT_URL"]
return if params[:skip_redirect]
redirect_to ENV["REDIRECT_TO_OTHER_REMIT_URL"]
end
def authorization
... |
require 'rails_helper'
RSpec.describe "categories" do
describe "GET #index" do
it "get all categoriess" do
category = create(:category)
get "/api/categories"
expect(response).to be_success
expect(response).to have_http_status(200)
json = JSON.parse(response.body)
expect(json).... |
# frozen_string_literal: true
require 'rails_helper'
feature 'Email authentication', type: :feature do
context 'regular sign up path' do
let(:user_email) { 'chewy@therepublic.com' }
let(:user_password) { 'password' }
before do
visit root_path
click_link 'Signup'
end
context 'with va... |
class Transaction < ApplicationRecord
validates :txid, presence: true
validates :type, presence: true
validates :address, presence: true, :uniqueness => { :scope => [:type, :date] }
validates :ip_address, presence: true, :uniqueness => { :scope => [:type, :date] }
validates :date, presenc... |
require 'pry'
# Write your code here.
katz_deli = []
def line(katz_deli)
queue = []
queue_string = ""
if katz_deli.length > 0
# binding.pry
katz_deli.each_with_index do |person, index|
queue_string << " #{index+1}. #{person}"
end
puts "The line is currently:#{q... |
require 'spec_helper'
describe 'ConsolePresenter' do
before(:each) do
@presenter = ConsolePresenter.new
end
describe '.display_success' do
context 'given a message is passed to the presenter' do
let(:message) { 'This is a successful message' }
it 'prints the message with green text... |
RSpec.shared_examples :render_404 do |parameter|
it { expect(response).to render_template '_shared/404' }
it { expect(response).to have_http_status(:not_found) }
end |
# frozen_string_literal: true
ActiveModelSerializers.config.adapter = :json_api
class Date
def as_json(_options = nil) #:nodoc:
strftime('%d-%m-%Y')
end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.