text stringlengths 10 2.61M |
|---|
require File.dirname(__FILE__) + "/spec_helper"
describe EventDispatcher do
before(:each) do
@dispatcher = Object.new.extend(EventDispatcher)
@test_object = Object.new.extend(TestObject)
end
it "should properly register a callback" do
@dispatcher.register_callback("load_event", @test_object)
... |
class Chitter < Sinatra::Base
get '/peeps/new' do
if current_user
@peep = current_user.peeps.new
erb :'peeps/new'
else
flash.next[:errors] = ['You have to sign in to peep']
redirect 'sessions/new'
end
end
post '/peeps' do
if current_user
@peep = current_user.peeps.ne... |
class ApplicantJobHistoriesController < ApplicationController
load_and_authorize_resource :user
load_and_authorize_resource :applicant,:through=>:user,:singleton=>true
load_and_authorize_resource :applicant_job_history,:through=>:applicant
layout "applicants"
# GET /applicant_job_histories
#... |
class Payment < ApplicationRecord
validates :amount, presence: true
belongs_to :project
end
|
class Transaction
attr_reader :amount, :date, :balance, :debit
def initialize(amount = 0, balance = 0, debit = 0)
@amount = amount
@date = Time.new.strftime("%d/%m/%Y")
@balance = balance
@debit = debit
end
end
|
require 'spec_helper'
RSpec.describe Pretentious::Generator do
context 'Pretentious::Generator' do
before do
@fixture = Pretentious::Generator.new
Pretentious::Generator.test_generator = Pretentious::RspecGenerator
end
it "uses instance variables when used both in test and in fixtures" do
... |
json.array!(@medicament_comments) do |medicament_comment|
json.extract! medicament_comment, :id, :title, :review, :references
json.url medicament_comment_url(medicament_comment, format: :json)
end
|
class RenameFactorToMealequiv < ActiveRecord::Migration
def self.up
rename_column :nutritionals, :factor, :mealequiv
end
def self.down
rename_column :nutritionals, :mealequiv, :factor
end
end
|
class Website::Page::FirstRegistrationPage < Website::Base
# https://secure.tesco.com/register/default.aspx?from=http%3a%2f%2fwww.tesco.com%2fgroceries%2f
# https://secure.tesco.com/register/
set_url "#{Website::Site.instance.url}/register"
set_url_matcher /register/
#registration fields
element :input_mail, "... |
require 'albacore/albacoretask'
class GallioConsole
include Albacore::Task
include Albacore::RunCommand
OPTIONS = {
:debug => "/d",
:reports_directory => "/rd",
:reports_name => "/rnf",
:reports_type => "/rt",
:show_reports => "/sr",
:filter => "/f... |
require "application_system_test_case"
class ImageAssetsTest < ApplicationSystemTestCase
setup do
@image_asset = image_assets(:one)
end
test "visiting the index" do
visit image_assets_url
assert_selector "h1", text: "Image Assets"
end
test "creating a Image asset" do
visit image_assets_url
... |
Pod::Spec.new do |s|
s.name = 'iOSOTARTK'
s.version = '1.0.6'
s.summary = 'A framework for OTA files'
s.homepage = 'https://github.com/weweco123/iOSOTARTK'
s.license = 'MIT'
s.authors = {'weiwei' => 'weiweivik@163.com'}
s.platform = :ios, '9.0'
s.source = {:git => 'https://gith... |
class Api::V1::DashboardController < Api::V1::BaseController
def dashboard_graphs_user
user_per_day = {}
["1", "2", "3","4","5","6"].each_with_index do |day, index|
@date = (DateTime.now) - ((index + 1) * 7).days
@users = User.where(role: "patient", :created_at => @date..DateTime.now - (index * 7... |
class CreateReportcells < ActiveRecord::Migration[5.0]
def change
create_table :reportcells do |t|
t.string :dep_name
t.string :lab_name
t.string :res_name
t.string :kind
t.float :total
t.string :onu
t.string :state
t.string :blend
t.string :code
t.strin... |
require_relative 'base_page'
class HomePage < BasePage
def title
"Vraag demo aan"
end
set_url "#{Global.settings.base_url}"
selector :register_button, '*//div[1]/div/div[2]/section[1]/div/div[1]/div/div/div[1]/div[2]/a[1]'
selector :sign_up_button, "//header//a[contains(text(), 'Inloggen')]"
selec... |
require_relative 'recipient'
module Slack
class Channel < Recipient
attr_reader :name, :topic, :num_members, :id
def initialize(id, name, topic, num_members)
super(id, name)
@topic = topic ||= "No topic"
@num_members = num_members
end
def details
tp self, "id", "name", "... |
#
# Author:: Matheus Francisco Barra Mina (<mfbmina@gmail.com>)
# © Copyright IBM Corporation 2015.
#
# LICENSE: MIT (http://opensource.org/licenses/MIT)
#
module Fog
module Softlayer
class Account
class Mock
# Get all accounts who are owned by brand.
# @param [Integer] identifier
#... |
def roll_call_dwarves(array)
# numbered = []
array.each_with_index { |item, index| puts "#{index+1}#{item}" }
# numbered
end
def summon_captain_planet(array)
array.map{|newArray| "#{newArray.capitalize}!"}
end
def long_planeteer_calls(array)
array.any?{ |long_words| long_words.length > 4 }
end
def find_the... |
class ApplicationController < ActionController::Base
protect_from_forgery
helper_method :current_user
before_filter :set_locale
after_filter :store_requested_path
private
def store_requested_path
session[:requested_path] = request.path
end
def current_user_session
return @current_user_session... |
class Info
attr_reader :name, :value, :observers
#subject is initialized with an empty list of interested parties (observers)
def initialize(name, value)
@name = name
@value = value
@observers = []
end
#changing the value using this custom writer method also informs observers
def value=(new_value)
@val... |
class Hand
attr_reader :deck, :cards, :value
attr_accessor :tie_value
def initialize(deck)
@deck = deck
@cards = @deck.deal(5)
@tie_value = nil
@value = hand_value
end
def values
cards.map(&:value)
end
def suits
cards.map(&:suit)
end
def hand_value
if straight_flush?
... |
require 'lyricfy'
class SongLyrics
def initialize(artist, title)
@artist, @title = artist, title
end
def self.fetch(artist, title)
new(artist, title).fetch
end
def fetch
return unless valid?
fetcher = Lyricfy::Fetcher.new
song = fetcher.search @artist, @title
song.nil?? 'No lyrics ... |
require 'rails_helper'
RSpec.describe ContractResponsibleFinancial, type: :model do
it 'has a valid factory' do
expect(create :contract_responsible_financial).to be_valid
end
it { should validate_presence_of :name }
end
|
require_relative 'message_constants'
module GroupBuzz
class EmailBodyProcessor
include GroupBuzz::MessageConstants
def remove_reply_header(body)
body.gsub(GROUPBUZZ_REPLY_HEADER_LINE, "")
end
def remove_starting_line_breaks(body)
body.lstrip
end
def remove_ending_line_breaks(bo... |
require 'faraday'
require 'faraday_middleware'
require 'angellist_api/core_ext/hash'
require 'angellist_api/request/multipart_with_file'
require 'angellist_api/request/gateway'
require 'angellist_api/request/angellist_api_oauth'
require 'angellist_api/response/raise_client_error'
require 'angellist_api/response/raise_s... |
# User Model
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
has_many :requests
has_many :books, thro... |
#
# Chef Cookbook : eos
# File : files/defaults/eos.rb
#
# Copyright (c) 2013, Arista Networks
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# Redistributions of source cod... |
class Card < ActiveRecord::Base
belongs_to :card_apply_template
validates :wx_card_id, presence: true, uniqueness: true
validates :title, presence: true, uniqueness: true
enum kind: {
"GROUPON" => 0,
"DISCOUNT" => 1,
"GIFT" => 2,
"CASH" => 3,
"GENERAL_COUPON" => 4,
"MEMBER_CARD" =... |
require 'interactors/library_interactor'
require 'interactors/cv_interactor'
require 'serializers/card_serializer'
class SearchController < BaseController
set :protection, :except => [:json_csrf]
get '/comicvine' do
param :query, Array
param :id, Array
param :minimal, Boolean, defau... |
class CreateReviewCoinTransactions < ActiveRecord::Migration[6.0]
def change
create_table :review_coin_transactions do |t|
t.string :from
t.string :to
t.references :review, foreign_key: true
t.integer :amount
t.timestamps
end
add_foreign_key :review_coin_transactions, :users,... |
require 'rails_helper'
RSpec.feature "UserCanFilterLinksByStatuses", type: :feature do
it "should filter links on the page when selecting unread only", js: true do
user = create(:user)
user.links.create(title: "JavaScript for Cats", url: "http://jsforcats.com/", read: true)
user.links.create(title: "Cats... |
require_relative '../spec_helper'
describe 'user goes to conditions dashboard' do
it 'has dashboard values' do
subscription = Subscription.create(account: "subscriber")
city = City.create(name: "San Jose")
station_1 = city.stations.create(name: "Golden Gate", dock_count: 22,
installation_date: '01/... |
class User < ActiveRecord::Base
devise :invitable, :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
has_many :stripes
validates :username, presence: true, uniqueness: true
validates :name, presence: true
attr_accessible :email, :password, :password_conf... |
require_relative 'card'
class Deck
# Returns an array of all 52 playing cards.
def self.all_cards
cards = []
Card.suits.each do |suit|
Card.values.each do |value|
cards << Card.new(suit, value)
end
end
cards
end
# Initializes with all 52 cards by default
def initialize(c... |
class RawPacket < BinData::Record
endian :big
uint32 :header_protocol
uint32 :frame_length
uint32 :stripped
uint32 :raw_header_length
string :payload, :length => lambda {raw_header_length + ( (4 - (raw_header_length % 4)) % 4) }
#string :payload, :length => :raw_header_length, :byte_align => 4
... |
require 'test_helper'
class CommentTest < ActiveSupport::TestCase
test "converting comment rating to human readable rating" do
# comment = FactoryGirl.build(:comment, :rating => "1_star", :user => nil, :place => nil)
comment = Comment.new(:rating => "1_star")
assert_equal "one star", comment.humanized_ra... |
require 'fileutils'
require 'zip/zip'
# Just a simple helper class to export quickly an existing and live locomotive website.
# FIXME: will be replaced by the API in the next months
module Locomotive
class Export
@@instance = nil
def initialize(site, filename = nil)
@site = site
@file... |
Rails.application.routes.draw do
mount AccountProfile::Engine => "/account_profile"
end
|
class Auto < ActiveRecord::Base
has_many :repairs
has_many :rentings
has_many :accidents
has_many :insurances
attr_accessible :brand, :model, :series, :color, :image, :next_check_date, :model_year
validates_presence_of :brand, :model, :series, :color, :model_year
validates_length_of :brand, maximum: 40... |
class Person
attr_accessor :name, :sex, :age
def initialize(name, sex, age)
@name = name
@sex =sex
@age = age
end
def getPersonMessage
"姓名:#{@name},性别:#{@sex},年龄:#{@age}"
end
end
|
class Book < ApplicationRecord
has_many :rents, dependent: :destroy
validates :genre, :author, :image, :title, :editor, :year, presence: true
def current_rent
Rent.where(book_id: id).current.first
end
def image_url
image
end
end
|
class User < ActiveRecord::Base
has_many :ideas
validates_uniqueness_of :user_name
acts_as_authentic do |c|
c.validate_password_field false
c.merge_validates_format_of_email_field_options(:message => I18n.t('error_messages.email_invalid', :default => "address is invalid."))
c.merge_validates_unique... |
json.array!(@channels) do |channel|
json.extract! channel, :id, :url, :name, :progress
json.url channel_url(channel, format: :json)
end
|
# frozen_string_literal: true
module SFRest
# We need to keep this naming due to the way connection.rb autoloads things.
# rubocop: disable Naming/ClassAndModuleCamelCase
# Manage the site update priority feature.
class Site_update_priority
# rubocop: enable Naming/ClassAndModuleCamelCase
# @param [SF... |
class RepliesController < ApplicationController
before_action :authenticate_owner!
def create
@ticket = Ticket.find_by uniq_reference: params[:ticket_id]
@reply = @ticket.replies.create(reply_params)
if @reply.save
flash[:notice] = "Reply created!"
@ticket.update_attribute :state_id, repl... |
class ChangeEnergyApplicationTextFieldsToString < ActiveRecord::Migration[5.2]
def up
change_table :energy_applications do |t|
t.change :first_name, :string
t.change :first_name, :string
t.change :last_name, :string
t.change :mailing_address_street, :string
t.change :mailing_address_... |
class Homepage
include PageObject
page_url "http://www.sky.com"
button(:search_button, :name=>'sky-header-search-submit')
text_field(:search_box, :name=>'query')
link(:shop, :text=>'Shop')
end
|
class Question < ActiveRecord::Base
validates :poll_id, presence: true
validates :question, presence: true
# Question#response
has_many :responses, :through => :answer_options, source: :responses
belongs_to(
:poll,
class_name: "Poll",
foreign_key: :poll_id,
primary_key: :id
)
has_many(
... |
# Represents a Point object, a 2D x-y coordinate.
class Point
attr_accessor :x, :y
# Constructor of a Point.
# Params:
# x: The coordinate on the X-axis.
# y: The coordinate on the Y-axis.
def initialize(x = 0, y = 0)
@x = x
@y = y
end
def +(val)
temp = Point.new(@x, @y)
if val.is_a? P... |
require 'pry'
class MyCar
attr_accessor :color # 2.
attr_reader :year # 2.
def initialize(year, model, color)
@year = year
@model = model
color = color # 2.
@current_speed = 0
end
def accelerate(number)
@current_speed += number
puts "You step on the gas and accelerate to #{@current_s... |
class ExpenseRepository
include Lotus::Repository
def self.find_by_category_id(id)
query do
where(category_id: id)
end
end
end
|
# frozen_string_literal: true
class CommentsController < ApplicationController
before_action :set_play
def create
@comment = @play.comments.build(comment_params)
@comment.user_id = current_user.id
render :index if @comment.save
end
def destroy
@comment = Comment.find(params[:id])
render :... |
# Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0'
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
base_j... |
class VotesController < ApplicationController
def new
unless params[:Body].blank? && params[:From].blank?
phone_number = params[:From].tr('^0-9','')
incoming_message = params[:Body].strip.upcase
@sms_response = nil
if incoming_message == 'HELP'
@sms_response = I18n.t :help,... |
#!/usr/bin/ruby
#using case
def printing(n)
(1..n).each do|i|
case i
when ->(n) {n.modulo(3).zero? && n.modulo(5).zero?} #divisibility test for 3 and 5
puts "FizzBuzz"
when ->(n) {n.modulo(3).zero?} #divisibility test for 3
puts "Fizz"
when ->(n) {n.modulo(5).zero?} #divisibility test for 5
put... |
module Effect
class SpellAttackFromScroll < SpellAttack
def initialize(parent, damage_type)
super
end
def weapon_intent(intent)
super
intent.add_cost :scroll_consumption, self.method(:consume_scroll)
return intent
end
def consume_scroll(action, intent)
case action
when :poss... |
# == Schema Information
#
# Table name: usage_statistics
#
# id :integer not null, primary key
# users :integer
# animals :integer
# households :integer
# organizations :integer
# service_providers :integer
# created_at :datetime
# updated_at ... |
require_relative 'reservation'
require_relative 'block'
require 'date'
require 'pry'
module Hotel
class Admin
attr_reader :rooms, :reservations, :blocks
def initialize
@reservations = []
@rooms = (1..20).to_a
@blocks = []
end
def book_room(reservation)
if reservation.class !... |
require "spec_helper"
feature "Visiting pages" do
scenario "like the home page" do
visit "/"
expect(page).to have_content "The Future Project"
expect(page).not_to have_selector("body > footer button")
end
scenario "to see a preview of uncached pages" do
visit "/preview"
expect(page).to have_... |
require 'rails_helper'
RSpec.describe Dashboard::MealsController, type: :controller do
let(:user) { FactoryGirl.create(:user) }
let(:other_user) { FactoryGirl.create(:user) }
let!(:my_meal) { FactoryGirl.create(:meal, user: user)}
let!(:others_meal) { FactoryGirl.create(:meal, user: other_user)}
describe "G... |
class GoogleDirectionsService
def initialize
@base_url = "https://maps.googleapis.com/maps/api/directions/json?"
@api_key = ENV['GOOGLE_DIRECTIONS_API']
end
def make_connection(step)
connection = {}
if step["travel_mode"] == "TRANSIT"
connection[:origin_city] = step["transit_details"]["de... |
# web elements and functions for page
class BookLoginPage
include Capybara::DSL
include RSpec::Matchers
include Capybara::RSpecMatchers
def initialize
@user_name = Element.new(:css, '.login-wrapper #userName')
@password = Element.new(:css, '.login-wrapper #password')
@login_btn = Element.new(:css, ... |
class RoomIssuesController < ApplicationController
before_action :set_room_issue, only: [:show, :edit, :update, :destroy]
# GET /room_issues
# GET /room_issues.json
def index
@room_issues = RoomIssue.all
end
# GET /room_issues/1
# GET /room_issues/1.json
def show
end
# GET /room_issues/new
... |
class Admin::WorkdetailsController < ApplicationController
before_filter :authorize_admin
# GET /workdetails
# GET /workdetails.json
def index
@workdetails = Workdetail.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @workdetails }
end
end
# GET /... |
class BidsController < ApplicationController
skip_before_action :authenticate_user!, only: [:index, :show]
# before_action :bids, only: [:show, :update]
def create
@bid = Bid.new(bids_params)
@bid.user = current_user
@bid.collectible = Collectible.find(collectible_params[:collectible_id])
if @bid... |
# frozen_string_literal: true
module Vedeu
module Events
# Allows the storing of events.
#
# @api private
#
class Repository < Vedeu::Repositories::Repository
class << self
# Remove all stored models from the repository.
#
# @example
# Vedeu.events.rese... |
# 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 rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel... |
require 'logger'
module NineOneOne
class Configuration
attr_accessor :send_pagers, :pager_duty_integration_key,
:slack_channel, :slack_enabled, :slack_username, :slack_webhook_url,
:logger
def initialize
self.send_pagers = false
self.slack_enabled = false
... |
class AddAttributesToBookings < ActiveRecord::Migration[5.0]
def change
add_column :bookings, :first_name, :string, null: false
add_column :bookings, :last_name, :string, null: false
add_column :bookings, :phone_number, :string, null: false
add_column :bookings, :date, :date, null: false
end
end
|
require 'rails_helper'
RSpec.describe FacilitiesManagement::DeliverableMatrixSpreadsheetCreator do
include ActionView::Helpers::NumberHelper
subject(:wb) do
spreadsheet_builder = described_class.new(contract.id)
spreadsheet = spreadsheet_builder.build
path = '/tmp/deliverable_matrix_3_1year.xlsx'
... |
class ChangeResponse < ActiveRecord::Migration
def change
remove_column :interactions, :response
add_column :interactions, :response_sentiment, :boolean
add_column :interactions, :response_other, :boolean
rename_column :interactions, :complete, :viewed
end
end
|
module EditableText
class MainController < Volt::ModelController
attr_accessor :section
reactive_accessor :toggled
def index
self.toggled = false
end
def body_element
Element.find('body')
end
def toggle_editing
self.toggled = !toggled
if toggled
# Editin... |
# # encoding: utf-8
# Inspec test for recipe Velocity2::database
# The Inspec reference, with examples and extensive documentation, can be
# found at http://inspec.io/docs/reference/resources/
describe mysql_conf('/etc/mysql-default/my.cnf').params('mysqld') do
its('port') { should eq '3306' }
its('socket') { sho... |
require 'rubygems'
require 'rest_client'
require 'net/http'
require 'digest'
require 'json'
require 'cgi'
require 'uri'
module Tether
# a chainable request object
class Request
attr_reader :base_url, :params
attr_accessor :generate_sig
def initialize(url, params={})
@base_url, @params, = url, pa... |
module PivotalPlanningPoker
class InvalidResponseError < StandardError ; end
class Client
attr_reader :token
def initialize(token)
@token = token
end
def get(url)
response = Curl::Easy.perform(url) do |curl|
curl.headers = {'X-TrackerToken' => token}
end
if respon... |
class Credential < ActiveRecord::Base
acts_as_archive
belongs_to :user
validates_presence_of :user, :provider, :identifier
validates_uniqueness_of :identifier, :scope => [:provider]
before_save :normalize_provider_and_identifier
def self.find_by_provider_and_identifier(provider, identifier)
... |
class CreatePosts < ActiveRecord::Migration
def change
create_table :posts do |t|
t.text :content
t.references :user, :index => true, :foreign_key => true
t.timestamps :null => false
end
add_index :posts, [:user_id, :created_at]
end
end
|
module Apress
module Images
module Cropable
extend ActiveSupport::Concern
CROP_ATTRS = [:crop_w, :crop_h, :crop_x, :crop_y].freeze
included do
class << self
alias_method_chain :attachment_options, :crop
end
if instance_methods.include?(:options_for_delayed_en... |
#
# Cookbook Name:: vim-setup
# Recipe:: default
#
# Copyright 2014, YOUR_COMPANY_NAME
#
# All rights reserved - Do Not Redistribute
#
USER = 'vagrant'
GROUP = 'vagrant'
template ".vimrc" do
path "/home/vagrant/.vimrc"
source "vimrc.erb"
owner USER
group GROUP
mode 00744
end
directory "/h... |
class TipodocumentosController < ApplicationController
before_filter :require_login
# GET /tipodocumentos
# GET /tipodocumentos.json
def index
@tipodocumentos = Tipodocumento.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @tipodocumentos }
end
end
... |
# frozen_string_literal: true
# command for user authentication
class AuthenticateUser
prepend SimpleCommand
def initialize(phone_number, name, verif)
@phone_number = phone_number
@name = name
@verif = verif
end
def call
JsonWebToken.encode(id: user.id, name: user.name) if user
end
priva... |
class ModifyJobs < ActiveRecord::Migration[5.1]
def change
remove_column :jobs, :service_id
remove_column :jobs, :value
end
end
|
class Api::V1::StudiosController < ApplicationController
def index
studios = Studio.all.sort_by { |studio| studio.name }
render json: studios, include: [:users]
end
def update
studio = Studio.find(params[:id])
studio.update!(studio_params)
render json: studio,... |
class Movie < ApplicationRecord
has_many :favorite_movies
has_many :users, through: :favorite_movies
end
|
# frozen_string_literal: true
module SimpleError
module_function
def call(status, error)
{
status: status,
msg: error.full_messages.to_sentence,
}
end
end
|
# frozen_string_literal: true
require 'sinatra/base'
require 'jiji/web/services/abstract_service'
module Jiji::Web
class AgentService < Jiji::Web::AuthenticationRequiredService
options '/sources' do
allow('GET,POST,OPTIONS')
end
get '/sources' do
sources_without_body = registry.agent_source... |
class Portal < ApplicationRecord
belongs_to :user, inverse_of: 'portals'
validates :name, presence: true
def portal_column_count
portal_columns.size
end
def portal_columns
return @portal_columns if @portal_columns
gadgets = get_gadgets
@portal_columns = [[], [], []]
PortalLayout.where(... |
require "redis"
require "redis/namespace"
module Ruboty
module Brains
class Redis < Base
KEY = "brain"
attr_reader :thread
env :REDIS_SAVE_INTERVAL, "Interval sec to push data to Redis (default: 5)", optional: true
env :REDIS_URL, "Redis URL (e.g. redis://foo:bar@example.com:6379/)", op... |
FactoryGirl.define do
factory :user do
email 'user@example.com'
password 'password'
password_confirmation { |attrs| attrs[:password] }
end
end
|
require 'spec_helper'
class MockSite
attr_reader :config
def initialize(config)
@config = config
end
end
class MockContext
attr_reader :registers
def initialize(config)
@registers = {
site: MockSite.new(config)
}
end
end
class MockSiteContext
include Jekyll::Contentful::RichTextFilte... |
Rails.application.routes.draw do
namespace :api, defaults: { format: :json } do
namespace :v1 do
resources :events, only: [:index, :create]
delete 'erase', to: 'events#erase'
get 'events/actors/:id', to: 'events#filtered'
end
end
# resources :events, only: [:index, :create], defaults:... |
pasta_ingredients = ["pasta", "marinara sauce", "bell pepper", "onion", "garlic", "tomato"]
guests_diet_restrictions = {
"Amy" => "meat",
"Brandon" => "lactose",
"Caroline" => "eggs",
"Daryl" => "peanuts"
}
#iterate through pasta ingredients array
puts "Pasta ingredients before .each:"
p pasta_ingr... |
#!/usr/bin/env ruby
require_relative '../config/environment'
class Cli
def run_game
puts "Welcome to Tic-Tac-Toe."
puts "Please input your choice (0-2): 0 , 1, or 2 Players."
choice = gets.chomp
case choice
when "0"
Game.new(Computer.new('X'), Computer.new('O')).play
when "1"
puts "Please w... |
require 'formula'
class Spidermonkey <Formula
url "http://ftp.mozilla.org/pub/mozilla.org/js/js-1.7.0.tar.gz"
homepage 'https://developer.mozilla.org/en/SpiderMonkey'
md5 '5571134c3863686b623ebe4e6b1f6fe6'
depends_on 'readline'
def patches
DATA
end
def install
ENV.j1
# Spidermonkey hard... |
require 'rails_helper'
RSpec.describe "New Students Registered", :type => :request do
describe "Button to registered" do
it "get students new registration page" do
get "/students"
end
end
end
RSpec.describe "New Students to go to New path", :type => :request do
describe "the form for students to fil... |
Rails.application.routes.draw do
resources :programs
get 'welcome/index'
resources :player_cards, only: [:index, :show], path: 'players'
root 'welcome#index'
end
|
Então(/^o código de reposta HTTP deve ser "([^"]*)"$/) do |http_code|
expect(@result.response.code).to eql http_code
end
Então(/^apos o cliente consultar o saldo o valor deve ser (\d+)$/) do |value|
result = get_balance(@token)
expect(result.parsed_response['balance']).to eql value.to_i
end
Então(/^o ATM exibe... |
#==============================================================================
#
# • Dhoom Petrified State v1.3a
# -- Last Updated: 2015.07.08
# -- Level: Easy
#
# Aditional Credit :
# - joeyjoejoe (Commission requester)
#
#==============================================================================
$imported ... |
Rails.application.routes.draw do
root to: 'gossips#index'
resources :gossips
resources :cities
resources :user
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
end
|
# -------------------------------------------------------------------------- #
# Copyright 2002-2018, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# no... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.