text stringlengths 10 2.61M |
|---|
module HelloTxt
module VERSION # :nodoc:
MAJOR = 1
MINOR = 0
TINY = 4
STRING = [MAJOR,MINOR,TINY].join('.')
end
autoload :Keyloader, 'hellotxt/keyloader'
autoload :Client, 'hellotxt/client'
end
# EOF
|
module BCommerce
module Catalog
RSpec.describe ProductsList do
let(:store_hash) { rand.to_s }
let(:auth_token) { rand.to_s }
let(:client_id) { rand.to_s }
let(:products_list) { ProductsList.new }
it 'inherits from BCommerce::ResourceList' do
expect(ProductsList).to be < Reso... |
require 'rails_helper'
RSpec.describe "Routing to robots", type: :routing do
it 'routes get /robots to robots#index' do
expect(get: "/robots").to route_to("robots#index")
end
it 'routes post /models/1/robots to robots#create' do
expect(post: "/models/1/robots").to route_to("robots#create", model_id: "1... |
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :character do
name "James"
description "Stark"
end
factory :fate_core_character, parent: :character do
name "James LeBlank"
description "Stark"
# aspects [ FactoryGirl.create(:aspect, name: "T... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
# config.vm.network "public_network", bridge: "enp2s0", auto_config: false
config.vm.provider "virtualbox" do |vb|
# vb.cpus = 4
# vb.memory = "4096"
# enable promiscuous mode on the publ... |
class CuentaBancaria
attr_accessor :saldo
attr_reader :banco, :numero_de_cuenta
def initialize(banco, numero_de_cuenta, saldo = 0.0)
raise ArgumentError, "Numero de cuenta solo debe contener numeros" if (numero_de_cuenta.count('a-z') > 0 || numero_de_cuenta.count('A-Z') > 0)
@banco = banco
... |
class AddKevinToStudents < ActiveRecord::Migration
def change
add_column :students, :kevan, :boolean
end
end
|
class CourseCategoryController < ApplicationController
def index(user)
if (!params[:course_id].blank? && (params[:course_id].to_i != 0))
course_id = params[:course_id].to_i
user.initialize_course_categories(course_id)
cc = user.course_categories.where(course_id: course_id, final: true, deleted:... |
class Exporter::Incidents < Exporter::Exporter
def column_definitions
column("incident_number") { record.incident_number }
column("district") { record.district }
column("reporting_area") { record.reporting_area }
column("shooting") { record.shooting }
column("occurred_on_date") { record.occurred_o... |
require 'spec_helper'
describe Providers::Conductor::ConductorClient do
it "returns a list of deployments", :vcr, record: :none do
with_provider 'test_conductor' do |provider|
client = conductor_client("admin", "password", provider)
client.deployments.should_not be_empty
end
end
it "indicat... |
class ResourceItem < ApplicationRecord
belongs_to :resource_topic
enum status: { draft: 0, published: 1 }
validates_presence_of :title, :body, :resource_topic_id, :status
has_many :resource_comments, dependent: :destroy
has_many :checkboxes, dependent: :destroy
has_many :questions, dependent: :destroy
... |
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :collection_for_parent_select
before_filter :prepare_for_mobile
private
def current_cart
if session[:cart_id]
@current_cart ||= Cart.find(session[:cart_id])
session[:cart_id] = nil if @current_cart.pur... |
class RemoveUserLicenseFromUserQualifications < ActiveRecord::Migration
def change
remove_index :user_qualifications, :user_license_id
remove_column :user_qualifications, :user_license_id
end
end
|
class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.string :email
t.string :first_name
t.string :last_name
t.string :google_id
t.string :refresh_token
t.string :profile_photo
t.string :default_printer_id
t.timestamps null: false
... |
module Mutations
class DisableQuizQuestion < Mutations::BaseMutation
description 'Hide a potential question from being displayed on a quiz.'
argument :quiz_id, ID, required: true
argument :question_id, ID, required: true
type Boolean
def resolve(quiz_id: nil, quest... |
class AppliedApplicantsController < ApplicationController
layout "companies"
def index
@user=current_user
@company=@user.company
@applicant=@user.applicant
@job_posts=@company.job_posts
end
end
|
require "spec_helper"
describe Qe::Immediate do
let(:job) { mock("job").as_null_object }
it "sets options" do
HelloWorker
.should_receive(:new)
.with(:a => 1)
.and_return(job)
Qe::Immediate.enqueue(HelloWorker, :a => 1)
end
it "performs job" do
HelloWorker.stub :new => job
... |
class Post < ActiveRecord::Base
validates_presence_of :body, :title
belongs_to :user
belongs_to :game
has_many :comments, dependent: :destroy
has_many :ratings
def average_rating
return 0 if ratings.size == 0
ratings.sum(:score) / ratings.size
end
end
|
class Paragraph < ActiveRecord::Base
acts_as_taggable
belongs_to :story
has_one :user, :through => :story
validates_presence_of :story_id
has_one :asset, :as => :attachable, :dependent => :destroy
def is_empty?
(!self.body || self.body.empty?) && (!self.asset || self.asset.empty?)
end
... |
class User < ApplicationRecord
has_secure_password
has_many :donations # array
has_many :organizations, through: :donations
end
|
class Api::MetersController < ApplicationController
skip_before_filter :verify_authenticity_token, :if => Proc.new { |c| c.request.format == 'application/json' }
# GET /api/meters
# GET /api/meters.json
def index
respond_to do |format|
if params[:car_id] && params[:year] && params[:month] && params[:... |
require 'spec_helper'
describe RabbitJobs::Worker do
before(:each) do
RJ.configure do |c|
c.server 'amqp://localhost'
c.queue 'default'
end
end
let(:worker) { RJ::Worker.new(:default) }
describe '#consumer' do
it 'validates consumer type' do
old_consumer = worker.consumer
... |
require 'rubygems'
require 'iso_country_codes'
class TLD
class Name
NAME_MAP = {
:aero => 'Aeroplane',
:arpa => 'Address and Routing Parameter Area (ARPA)',
:asia => 'Asia',
:bitnet => 'BITNET',
:biz => 'Business',
:cat => 'Catalan',
:com ... |
class CoachesAreaMailer < ApplicationMailer
def coaches_area_created ca
@ca = ca
mail(to: @ca.area.stadium.user.email, subject: "⚽️ Bookingsports: Запрос тренера на привязку к стадиону")
end
def coaches_area_destroyed ca
@ca = ca
mail(to: @ca.area.stadium.user.email, subject: "⚽️ Привязка тренера... |
# Create a Playlist from Driver Code
# I worked on this challenge [by myself, with: ].
# I spent [#] hours on this challenge.
# Pseudocode
#Create a class called Song
# Initial Solution
class Song
attr_accessor :song
attr_accessor :band
def initialize(song,band)
@song = song
@band = band
end
d... |
class AddSuggestionFieldsToNotifications < ActiveRecord::Migration
def change
add_column :notifications, :suggest_activity, :string, null: true, default: ''
add_column :notifications, :suggest_datetime, :datetime, null: true
add_column :notifications, :suggest_location, :string, null: true, default: ''
... |
class Expense < ActiveRecord::Base
belongs_to :budget
belongs_to :expense_category
validates :amount, presence: true
end
|
require './string_calculator'
require 'rspec/core'
describe StringCalculator do
before do
@calculator = StringCalculator.new
end
it 'returns 0 for the empty string' do
expect(@calculator.add("")).to eq 0
end
it 'returns 1 for the string "1"' do
expect(@calculator.add("1")).to eq 1
end
it '... |
class ProposalSearchSerializer < ActiveModel::Serializer
delegate :current_page, :from, :size, to: :object
attributes(
:current_page,
:from,
:proposals,
:size,
:total
)
def total
object.es_response ? object.es_response.results.total : object.total
end
def proposals
ActiveModel... |
# frozen_string_literal: true
module DataFilter
class MostPageViews
def self.collect_filtered_logs(records)
grouped_logs = records.group_by(&:endpoint)
filtered_logs = grouped_logs.map { |endpoint, ip| [endpoint, ip.count] }
filtered_logs.sort_by { |_endpoint, count| -count }.to_h
end
end... |
class Room
# We can read and write to the name if need be
attr_accessor :name, :capacity, :tab
attr_writer :capacity
def initialize(name, songs, room_capacity, items)
@name = name
@songs = songs
@guests = []
@capacity = room_capacity
@items = items
@tab = 0
end
def item_count()
... |
# frozen_string_literal: true
FactoryBot.define do
sequence(:grantee_id) { |n| n }
end
|
class AddIsFinePaidAndBalanceFineToFinanceFee < ActiveRecord::Migration
def self.up
add_column :finance_fees, :is_fine_paid, :boolean
add_column :finance_fees, :balance_fine, :decimal, :precision => 15, :scale => 2
end
def self.down
remove_column :finance_fees, :is_fine_paid
remove_column :financ... |
# A wrapper around Naf::MachineRunnerInvocation used for rendering in views
module Logical
module Naf
class MachineRunnerInvocation
COLUMNS = [
'id',
'created_at',
'machine_runner_id',
'server_name',
'pid',
'status',
'commit_information',
'de... |
class AddAttributesToProblemReport < ActiveRecord::Migration[5.1]
def change
add_column :problem_reports, :venue, :string
add_column :problem_reports, :computer_number, :string
add_column :problem_reports, :description, :string
add_column :problem_reports, :is_critical, :boolean
add_column :proble... |
class Api::CommentsController < ApplicationController
def create
@comment = Comment.new(comment_params)
@comment.user = current_user
if @comment.save
@track = @comment.track
render template: "api/tracks/show"
else
render json: @comment.errors, status: 422
end
end
def destro... |
##
## Technique Disjoint Subset.
##
class DSubset < Technique
##
## Constructeur de la classe DSubset
##
## @return Une instance de la classe DSubset
##
def DSubset.creer()
new()
end
##
## Recherche une solution pour la technique utilisée
##
## @param grille La grille
##
## @return Les i... |
require 'scraperwiki'
require 'mechanize'
require 'open-uri'
def extract_links(page)
page.at('#companylist ul').search('article').map do |a|
b = a.at('h1 a')
"http://www.bandt.com.au" + b['href']
end
end
def go_to_page(page, page_no)
form = page.forms[0]
form["__EVENTTARGET"] =
"plc$lt$zoneContent... |
class Department < ActiveRecord::Base
validates_presence_of :department_name
validates_uniqueness_of :department_name
has_many :rooms, :dependent => :destroy
has_many :doctors
end
|
Factory.define(:artist) do |f|
f.name {rand(1_000_000).to_s}
f.is_active true
end
|
class AddColumnsToPhysicalFiles < ActiveRecord::Migration
def change
add_column :physical_files, :file_name, :string
add_column :physical_files, :comments, :text
add_column :physical_files, :uploaded_by, :integer
add_column :physical_files, :rows_count, :integer
end
end
|
class Artist
attr_reader :name, :years_active
@@all = []
def initialize(name, years_active)
@name = name
@years_active = years_active
@@all << self
end
def self.all
@@all
end
#Get a list of all the paintings by a specific artists
def paintings
Painting.all.select {|p| p.artist... |
require 'yaml'
require 'jekyll-contentful-data-import/mappers'
module Jekyll
module Contentful
# Serializer class
#
# Transforms the serialized entries to YAML
class Serializer
attr_reader :entries, :config
def initialize(entries, config = {})
@entries = entries
@config =... |
class Song < ActiveRecord::Base
belongs_to :artist
belongs_to :genre
has_many :notes
#sets the artist to the artist specified name, instead of an ID
# this method is called whenever SOng is initialized with a artist_name field
def artist_name=(name)
self.artist = Artist.find_or_create_by(name: name)
... |
require 'spec_helper'
describe "Pinterest::Client::Pin" do
before do
@client = Pinterest::Client.new(ENV['ACCESS_TOKEN'])
end
describe 'POST /v1/pins/' do
context "have the parameters for a pin" do
it "should create a pin" do
VCR.use_cassette("v1_create_pin") do
response = @clie... |
require('rspec')
require('places')
describe(Place) do
before() do
Place.clear()
end
describe("#location") do
it("describes where we've been") do
test_place = Place.new("Bend, Oregon")
expect(test_place.location()).to(eq("Bend, Oregon"))
end
end
describe(".all") do
it("is an arra... |
# frozen_string_literal: true
require "spec_helper"
describe MPV::Client do
before(:each) do
@session = test_instance
@mpv = @session.client
end
after(:each) do
@mpv.command("quit")
end
it "can query properties" do
result = @mpv.get_property("volume")
expect(result).to be_success
e... |
require 'yaml'
require 'find'
require 'net/ftp'
Debug = false
class PhotoSorter
attr_accessor :photo_data
def initialize(yaml_file=nil)
@photo_data = nil
@yaml_file = yaml_file
@extension = 'jpg'
end
def parse_photo_data
photo_yaml_data = File.open(@yaml_file) { |f| f.read }
@photo_data... |
class Piece < ApplicationRecord
belongs_to :game
self.inheritance_column = 'piece_type'
def valid_move?(x, y)
on_board?(x, y) &&
game.piece_at(x, y)&.color != self.color &&
!is_obstructed?(x, y) &&
!would_be_in_check?(x, y)
end
# def last_piece
# last_piece = []
# las... |
class Release < ActiveRecord::Base
has_many :release_artists, dependent: :destroy
has_many :artists, through: :release_artists
mount_uploader :image, ReleaseUploader
end
|
class Removecreatedandupdatedfromusers < ActiveRecord::Migration[5.2]
def change
remove_column :users, :created
remove_column :users, :updated
end
end
|
require 'services/markdown_service'
describe MarkdownService do
it 'renders markdown' do
source = '**markdown** __rocks!__'
output = MarkdownService.instance.render(source)
expect(output).to eq("<p><strong>markdown</strong> <strong>rocks!</strong></p>\n")
end
end
|
require 'spec_helper'
RSpec.describe Drug do
include Helpers::DrugHelpers
before :each do
setup_drug_data
end
describe "typeahead results" do
it "should find viagra" do
expect( Drug.typeahead_search("Viag").length ).to eq 1
end
it "should match on substring" do
expect( Drug... |
class Response < ApplicationRecord
validates :statement, presence: true
belongs_to :user
belongs_to :question
# https://stackoverflow.com/questions/37750087/calling-a-method-of-another-controller: use self
# https://stackoverflow.com/questions/8225518/calling-a-method-from-another-controller
# https://stac... |
require "test/unit"
require "../unit_helper"
class RailRoadTest < Test::Unit::TestCase
def test_create_railroad
from = "A"
to = "B"
railroad = RailRoad(from, to, 5)
assert_equal(from, railroad.from)
assert_equal(to, railroad.to)
assert_equal(5, railroad.distance)
end
end
|
# frozen_string_literal: true
# This query is used by graphql-client so don't add the includeDeprecated
# argument for inputFields since the server may not support it. Two stage
# introspection queries will be required to handle this in clients.
GraphQL::Introspection::INTROSPECTION_QUERY = GraphQL::Introspection.quer... |
class JobRequestsController < ApplicationController
before_action :authorize_user, only: [:new, :edit, :create, :update, :destroy, :duplicate, :create_duplicate]
before_action :set_job_request, only: [:show, :edit, :update, :destroy, :duplicate, :create_duplicate]
before_action :set_deal
# GET /job_requests
... |
class Mocks
HOST = "127.0.0.1"
PORT = 15000
def self.get_endpoint
"http://#{HOST}:#{PORT}"
end
def self.create_mock_endpoint(scenario = "")
mep = MockEndpoint.new(scenario)
mep.start
mep
end
def self.load_fixture(filename, resp = '{}')
puts "Loading fixture: #{File.dirname(__FILE__)... |
module Elements
class Essence < ActiveRecord::Base
self.abstract_class = true
belongs_to :element, :class_name => '::Elements::Element'
belongs_to :property, :class_name => '::Elements::ElementProperty'
end
end
|
##
# = encoding_translation.rb
#
# Copyright (c) 2007 Operis Systems, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... |
# See https://scotch.io/tutorials/build-a-restful-json-api-with-rails-5-part-one
# See http://sourcey.com/building-the-prefect-rails-5-api-only-app/
module V1
class CommentsController < ApiController
include V1::Concerns::Docs::CommentsController
before_action :set_comment, only: [:show, :update, :destroy... |
class CreateTermTags < ActiveRecord::Migration
def change
create_table :term_tags do |t|
t.references :term
t.references :tag
t.timestamps
end
add_index :term_tags, :term_id
add_index :term_tags, :tag_id
end
end
|
module EARMMS::UserHelpers
def logged_in?
return false unless session.key?(:token)
t = EARMMS::Token.where(token: session[:token], :use => 'session').first
return false unless t
return false unless t.valid
return true
end
def current_user
return nil unless session.key?(:token)
return... |
module TheGrid
class Api::Command::Paginate < Api::Command
cattr_accessor(:default_per_page){ 10 }
def configure(relation, params)
{}.tap do |o|
o[:page] = params[:page].to_i
o[:page] = 1 if o[:page] <= 0
o[:size] = params[:size]
o[:per_page] = params[:per_page].to_i
... |
class TransportFeeCollection < ActiveRecord::Base
# belongs_to :batch
belongs_to :master_fee_particular
has_many :transport_fees, :dependent => :destroy
# has_many :transport_fee_collection_batches
has_many :transport_fee_collection_assignments
has_many :employee_departments, :through => :transport_fee_collec... |
class Stock < ApplicationRecord
has_many :port_stocks
has_many :portfolios, through: :port_stocks
has_many :port_stocks, dependent: :destroy
belongs_to :user
end
|
# 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... |
# == Schema Information
#
# Table name: project_snapshots
#
# id :integer not null, primary key
# project_id :integer not null
# task_count :integer
# original_estimate :integer
# work_logged :integer
# remaining_estimate :integer
# created_at :da... |
describe Set1::Challenge1 do
describe '#hex_to_base64' do
let(:input) { '49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d' }
let(:output) { 'SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t' }
it 'encodes correctly' do
expect(described... |
require 'spec_helper'
module Logical
module Naf
describe Application do
let(:columns) { [:id,
:title,
:short_name,
:script_type_name,
:application_schedules,
:deleted] }
let(:physical_a... |
module Shouter
class Builder
class << self
def register(object, options)
if options[:async]
_klass = Shouter::Listeners::Async
else
_klass = Shouter::Listeners::Sync
end
_klass.new(object, options)
end
end
end
end
|
class Polyclinic < ActiveRecord::Base
has_and_belongs_to_many :posts
has_many :schedules
has_many :doctors
has_many :routines
has_many :requests
validates :name, presence: true
validates :phone, presence: true
validates :address, presence: true
validates :district, presence: true
validates :localit... |
module Role::User
include Role::Base
allow :create_projects, :create_plans
allow :edit_projects, :edit_plans, :edit_plan
def can_edit_account?(user)
user == self
end
end
|
class AddTotalMoneyRaisedUsdToCompany < ActiveRecord::Migration
def change
add_column :companies, :total_money_raised_usd, :integer
end
end
|
class ServicesMailer < ApplicationMailer
helper MoneyHelper
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
# en.services_mailer.daily_update.subject
#
def daily_update(user, errors: [])
@report = EarningsReport.for(user)
@errors = errors
mail ... |
class ClassTimingSetsController < ApplicationController
before_filter :login_required
before_filter :check_status
before_filter :default_time_zone_present_time
filter_access_to :all
def index
@class_timing_sets = ClassTimingSet.paginate(:page => params[:page], :per_page => 30)
end
def new
@clas... |
# frozen_string_literal: true
require 'curses'
class ConsoleView
attr_reader :win, :instr, :status
POS_TO_BOARD = {
[2, 2] => 0, [2, 6] => 1, [2, 10] => 2, [5, 2] => 3, [5, 6] => 4,
[5, 10] => 5, [8, 2] => 6, [8, 6] => 7, [8, 10] => 8
}.freeze
def initialize
Curses.nonl
Curses.noecho
Curs... |
require 'spec_helper'
describe "ethnicities/index.html.erb" do
before(:each) do
assign(:ethnicities, [
stub_model(Ethnicity),
stub_model(Ethnicity)
])
end
it "renders a list of ethnicities" do
render
end
end
|
require_relative "../support/service"
#
# Bulk import stories by the same author
#
# Params:
# `author`: A string author name
# `stories`:
# An array of stories, each story is a tuple with structure:
# ```
# {
# name: "The name of the story",
# description: "A short description of the story used in ... |
require File.expand_path('../../spec_helper', File.dirname(__FILE__))
describe Tr8n::Tokens::Transform do
describe 'registering transform tokens' do
context 'incorrect tokens' do
it 'should not be registered' do
[
'Hello {user}',
'Hello {user:}',
'Hello {user::}'
... |
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
before_filter \
:expose_user_to_javascript,
:expose_config_to_javascript
after_filter :set_csrf_cookie_for... |
require File.dirname(__FILE__) + '/../spec_helper'
describe DocumentosController do
describe "handling GET /documentos" do
before(:each) do
@documento = mock_model(Documento)
Documento.stub!(:find).and_return([@documento])
end
def do_get
get :index
end
it "should be succe... |
class InvitationMailer < ActionMailer::Base
helper :invitation
default :from => "admin@milyoni.net"
def invite invitation
@invitation = invitation
mail(:to => invitation.email)
end
end |
#!/usr/bin/env ruby
require 'rubygems'
require 'bundler/setup'
$:.unshift(File.dirname(__FILE__))
require 'TestSetup'
require 'RandomThings'
class PgPathTest < Test
include SqlPostgres
include RandomThings
def test_ctor_defaults
path = PgPath.new
assertEquals(path.closed, true)
assertEquals(path.p... |
module Concerns::MetaHelper
def add_meta_keywords(keywords)
@additional_keywords = keywords
end
def set_og_title(title)
@og_title = title
end
def page_meta_tags
{ description: t('meta_tags.description'),
robots: 'all',
keywords: [t('meta_tags.keywords'), @additional_keywords].compact... |
class CreateSongs < ActiveRecord::Migration
def change
create_table :songs do |t|
t.string :name
t.string :artist
t.string :sc_id # Soundcloud ID -- might be integer and not string????
t.belongs_to :playlist
t.timestamps null: false
end
end
end
|
# == Schema Information
#
# Table name: promotions
#
# id :integer not null, primary key
# name :string not null
# slug :string not null
# company_name :string
# company_number :string
# address_ln_1 :string
# address_ln_2 ... |
# -*- encoding : utf-8 -*-
class Admin::TranslateeParamsController < ApplicationController
# GET /admin/translatee_params
# GET /admin/translatee_params.json
def index
@admin_translatee_params = Admin::TranslateeParam.all
respond_to do |format|
format.html # index.html.erb
format.json { render :json => @a... |
require 'rspec/distributed/version'
require 'rspec/distributed/hooks'
module RSpec
module Distributed
Config = Struct.new(
:client,
:server,
:server_host,
:server_port,
:client_host,
:client_port
)
def self.config
@config ||= Config.new
end
def self.con... |
class DepartamentosController < ApplicationController
# GET /departamentos
def index
@departamentos = @empresa.departamentos.find(:all)
end
# GET /departamentos/1
def show
@departamento = @empresa.departamentos.find(params[:id])
end
# GET /departamentos/new
def new
@departamento = @empres... |
require 'rails_helper'
RSpec.describe Item, type: :model do
describe '#create' do
before do
@item = FactoryBot.build(:item)
@item.image = fixture_file_upload('public/image/test_image.png')
end
context "登録できること" do
it "name,image,price,about,genre_id,condition_id,delivery_fee_id,pref... |
# frozen_string_literal: true
module Vedeu
module Presentation
# Provide access to the parent class for a {Vedeu::Views}
# instance.
#
# @api private
#
module Parent
include Vedeu::Common
# @return [NilClass|String|Symbol]
def name
if present?(@name)
@n... |
#encoding: utf-8
class GearItemsController < ApplicationController
before_filter :require_admin
before_filter :setup
# GET /gear_items
# GET /gear_items.json
def index
@gear_items = GearItem.where(:parent_id => nil)
respond_to do |format|
format.html # index.html.erb
format.json { rende... |
class Customer::RegistrationsController < ApplicationController
skip_before_filter :redirect_to_welcome
def index
redirect_to :action => :new
end
def new
@registration = true
@user = User.new
@user_session = UserSession.new
render :template => 'user_sessions/new'
end
def creat... |
require 'rails_helper'
feature 'post', type: :feature do
# このブロックの内部にscenarioを記述していく
let(:user){ create(:user) }
scenario 'post tweet' do
#ログイン前には投稿ボタンがない
visit root_path
expect(page).to have_no_content('投稿する')
#ログイン処理
visit new_user_session_path
fill_in 'user_email', with: user.email
... |
require 'rails_helper'
RSpec.describe AlbumsController, type: :controller do
login_user
let(:album) { create(:album_with_photos_and_tags, tags_count: 10, user: current_user) }
let(:user) { album.user }
let(:request_exec) { get :show, params: { user_id: user.id, id: album.id } }
describe "GET #show" do
... |
require 'test_helper'
class OrderSummariesControllerTest < ActionController::TestCase
setup do
@order_summary = order_summaries(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:order_summaries)
end
test "should get new" do
get :new
ass... |
class CreateProgramParameters < ActiveRecord::Migration
def change
create_table :program_parameters do |t|
t.integer :program_id, null: false
t.integer :parameter_id, null: false
t.boolean :is_recommended, null: false
t.integer :low
t.integer :high
t.text :choices, array: true
... |
class Location
def initialize(zip)
@zip = zip
end
def build_array_of_nearby_stores(key, zip)
StoreService.get_stores(key, zip).map do |data|
Store.new(data)
end
end
end
|
#!/usr/bin/ruby
# Utility script to parse local serial number and determine available AppleCare
# While we are at it, do some basic hardware auditing
# Gather it all up and send audit info to a HTTP(s) cache
# Puppet clues: sudo /usr/bin/gem install yajl-ruby colored
# Based on work from http://glarizza.posterous.co... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.