text stringlengths 10 2.61M |
|---|
class KnotesController < ApplicationController
before_filter :require_user, :except => [:show, :easier, :harder, :restore]
before_filter :require_valid_user, :except => [:show, :easier, :harder, :restore]
# before_filter { |c| @knotebook = Knotebook.find(c.params[:knotebook_id]) if c.params[:knotebook_id] }
#
... |
class Poll < ApplicationRecord
belongs_to :candidate
def self.to_csv
attributes = %w(id source date value candidate_id)
CSV.generate(headers: true) do |csv|
csv << attributes
all.each do |candidate|
csv << attributes.map{ |attr| candidate.send(attr) }
... |
require 'hpricot/htmlinfo'
def Hpricot(input, opts = {})
Hpricot.parse(input, opts)
end
module Hpricot
# Hpricot.parse parses <i>input</i> and return a document tree.
# represented by Hpricot::Doc.
def Hpricot.parse(input, opts = {})
Doc.new(make(input, opts))
end
# :stopdoc:
def Hpricot.make(inpu... |
ActiveAdmin.register Expert do
# See permitted parameters documentation:
# https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters
#
# Uncomment all parameters which should be permitted for assignment
#
permit_params :full_name, :description, :ex... |
require 'deepstruct'
module Pebblebed
module RSpecHelper
def god!(options = {})
options.delete(:god)
stub_current_identity({:id => 1, :god => true}.merge(options))
end
def user!(options = {})
options.delete(:god)
stub_current_identity({:id => 1, :god => false}.merge(options))
... |
json.data do
json.proposal do
json.id @proposal.id
json.customer_id @proposal.customer_id
json.artist_id @proposal.artist_id
json.status @proposal.status
json.proposal_items @proposal.proposal_items do |proposal_item|
json.id proposal_item.id
json.title proposal_item.title
json.d... |
class Beer < ActiveRecord::Base
include RatingAverage
validates :name, presence: true
belongs_to :brewery
belongs_to :style
has_many :ratings, :dependent => :destroy
has_many :raters, -> { uniq }, through: :ratings, source: :user
def to_s
"#{name} (" + brewery.name + ")"
end
end
|
class SessionsController < ApplicationController
def create
if @user = User.authenticate(session_params[:username],
session_params[:password])
session[:user_id] = @user.id
render_jsonapi_from(serializer_for: :session,
object: @user,
... |
def starts_with_a_vowel?(word)
if word.match(/\b[aieouAEIOU]\w/) then
true
else
false
end
end
def words_starting_with_un_and_ending_with_ing(text)
text.scan(/\bun\w+ing/)
end
def words_five_letters_long(text)
text.scan(/\b\w{5}\b/)
end
def first_word_capitalized_and_ends_with_punctuation?(text)
#capitaliza... |
# 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 rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Ch... |
# encoding: utf-8
class ListaReport < Prawn::Document
# ширина колонок
Widths = [20, 100, 70, 50, 50, 50, 50, 50, 50, 50]
# заглавия колонок
Headers = ["№", "RRE,SE si liniilor", "Punctul de evidenta", "", "№ contor.", "Indicatii",
"Indicatii", "Diferenta indicat.", "Coeficient contor.", "Ener... |
class CampaignMonitor
@@campaign = nil
def self.add_subscriber(user, list, custom_fields = nil)
load
list_id = self.get_list_id(list)
CreateSend::Subscriber.add(list_id, user.email, user.username, custom_fields, true)
end
def self.remove_subscriber(user, list)
load
list_id = self.get_list_... |
require 'rails_helper'
RSpec.describe "Generating a client report", type: :feature do
before do
@client = FactoryGirl.create(:client,
name: "DMU Leicester Castle Business School")
@client_channel = FactoryGirl.create(:client_channel,
type: "F... |
class MasterUpdateTradingInfoWorker
include Sidekiq::Worker
def perform(*args)
# Do something
count_crypto = cryptocurrencies.count
total_pages = (count_crypto / 10) + 1
total_pages.times do |i|
offset = i * 10
UpdateCryptoTradingInfoWorker.perform_in(offset.minutes.from_now, offset)
... |
class CreateEvents < ActiveRecord::Migration[5.0]
def change
create_table :events do |t|
t.string :name
t.string :headline
t.text :abstract
t.string :location
t.datetime :start_time
t.string :speaker
t.string :company
t.timestamps
end
end
end
|
cask 'android-sdk-custom' do
version "4333796"
sha256 'ecb29358bc0f13d7c2fa0f9290135a5b608e38434aad9bf7067d0252c160853e'
# dl.google.com/android/repository/ was verified as official when first introduced to the cask
url "http://artifactory.generagames.com:8081/artifactory/generic-local/macos/programming/android-... |
RSpec.shared_context "Messages" do
let (:messages) do
[Twitter::DirectMessage.new({id: 1}),
Twitter::DirectMessage.new({id: 2}),
Twitter::DirectMessage.new({id: 3}),
Twitter::DirectMessage.new({id: 4})]
end
end
|
class Review < ApplicationRecord
belongs_to :product
belongs_to :user
validates :content_body, length: { in: 50..250 }
validates :rating, inclusion: { in: 1..5 }
validates_presence_of :content_body, :rating
end
|
class Vote < ActiveRecord::Base
belongs_to :user
belongs_to :steam_app
validates :steam_app, uniqueness: { scope: :user }
validate :validate_weight
private
def validate_weight
if weight < 0
errors.add(:weight, 'must be > 0')
elsif Vote.where(user_id: user_id).sum(:weight) + weight > 100
... |
require 'active_merchant'
module PaymentService
class << self
def purchase_order(order, credit_card_params)
gateway = ActiveMerchant::Billing::TrustCommerceGateway.new(
:login => 'TestMerchant',
:password => 'password',
)
credit_card = ActiveMerchant::Billing::CreditCard.new(cre... |
require "test_helper"
describe User do
let (:text_user) {
User.new(name: 'SpongeBob')
}
describe "initilaiztaion" do
it "can be instantiated" do
expect(text_user.valid?).must_equal true
end
end
describe "validations" do
it "must have a name" do
text_user.name = nil
ex... |
# Downloads a URL to a local file on the worker
module VelocitasCore
class GpxDownloader
include Interactor
delegate :url, :filename, :attachment, to: :context
attr_accessor :response
#attr_accessor :url, :response, :filename
# @param [String] url The URL to the GPX file.
# @param [String] f... |
helpers do
def pre_filled_input(name, value)
erb(
:"partials/pre_filled_input",
:layout => false,
:locals => {:name => name, :value => value}
)
end
end |
require 'spec_helper'
require 'yt/models/statistics_set'
describe Yt::StatisticsSet do
subject(:statistics_set) { Yt::StatisticsSet.new data: data }
describe '#data' do
let(:data) { {"key"=>"value"} }
specify 'returns the data the statistics set was initialized with' do
expect(statistics_set.data).t... |
class HomeController < ApplicationController
def dashboard
@insurance_types = InsuranceType.roots.decorate
end
def contact_us
@contact_us_by_phone = @contact_us_by_email = ContactUs.new
end
def save_contact
contact_us = ContactUs.new(permit_contact)
if contact_us.save
UserMailer.send_contact_... |
class Rsvp < ApplicationRecord
belongs_to :user
belongs_to :event
# def set_total_price
# self.price = event.price
# total_days = (ends_at.to_date - starts_at.to_date).to_i
# self.total = price * total_days
# end
before_save :set_price
def set_price
price = self.event.price
end
def ... |
# frozen_string_literal: true
RSpec.describe SC::Billing::Stripe::Webhooks::Customers::CreateOperation, :stripe do
subject(:call) do
described_class.new.call(event)
end
let(:event) { StripeMock.mock_webhook_event('customer.created') }
let(:customer) { event.data.object }
context 'when user does not exi... |
class Director < ActiveRecord::Base
# A director has many movies
has_many :movies
end
|
# encoding: utf-8
# frozen_string_literal: true
require_relative '../../test_helper'
require 'pagy/extras/support'
require 'pagy/countless'
SingleCov.covered! unless ENV['SKIP_SINGLECOV']
describe Pagy::Frontend do
let(:frontend) { TestView.new }
describe "#pagy_prev_url" do
it 'returns the prev url for p... |
# frozen_string_literal: true
# Name.
When("I set the name to {string}") do |name|
step %(I fill in "taxon_name_string" with "#{name}")
end
# Protonym name.
When("I set the protonym name to {string}") do |name|
step %(I fill in "protonym_name_string" with "#{name}")
end
# Misc.
Then("{string} should be of the ra... |
class Post < ActiveRecord::Base
attr_accessible :author_id, :receiver_id, :body, :album_id, :photo
belongs_to :receivers, class_name: "User", foreign_key: "receiver_id"
belongs_to :author, class_name: "User", foreign_key: "author_id"
belongs_to :album
has_many :likes, as: :likeable
has_many :likers, throu... |
class AddHasWozToArm < ActiveRecord::Migration
def change
add_column :arms, :has_woz, :boolean, default: false
end
end
|
class Process < ActiveRecord::Base
has_many :processable_processes
has_many :processesables, through: :processable_processes
end
|
require 'date'
require_relative 'app_spec_helper'
describe "Put Request" do
describe "Invalid ID" do
put('/venues/someInvalidID', updated_name_json.to_json, standard_header)
response = last_response
it "should respond with status 404" do
expect(response.status).to eql(404)
end
it "shoul... |
class AddEmailOptions < ActiveRecord::Migration
def self.up
add_column :accounts, :email_info, :boolean, :default => false
add_column :accounts, :email_errors, :boolean, :default => false
end
def self.down
remove_column :accounts, :email_info
remove_column :accounts, :email_errors
end
end
|
# frozen_string_literal: true
class LiteralToken < Token
EXPRESSION = /\"(.*)\"/
def initialize(value)
@value = value
end
def to_s
"Literal(#{value})"
end
def debug_print(level)
pad = "\t" * level
"#{pad}#{to_s}"
end
def self.from(token_match)
new(token_match[1])
end
end
|
require 'keyutils/key'
require 'keyutils/key_types'
module Keyutils
class Keyring < Key
include Enumerable
# Clear the contents of the keyring.
#
# The caller must have write permission on a keyring to be able clear it.
# @return [Keyring] self
# @raise [Errno::ENOKEY] the keyring is invalid... |
class RemoveFollowersColumnFromUsers < ActiveRecord::Migration[5.0]
def change
remove_column :users, :followers
remove_column :users, :following
end
end
|
module Nationality
module Cell
class Survey < Abroaders::Cell::Base
def title
'Are You Eligible?'
end
private
def buttons
cell(Buttons, model)
end
class Buttons < Abroaders::Cell::Base
include Escaped
property :companion_first_name
pr... |
class VoteItemsController < ApplicationController
before_filter :authenticate, :only => [:index, :show, :new, :edit, :create, :update, :destroy]
before_filter :correct_user, :only => [:edit, :update, :destroy, :show]
# GET /vote_items
# GET /vote_items.xml
def index
@vote_items = current_user.rsvp_event... |
FactoryGirl.define do
factory :world, :class => Refinery::Worlds::World do
sequence(:Main_headline) { |n| "refinery#{n}" }
end
end
|
require "rails_helper"
RSpec.feature "edit space redirects to previous page" do
context "logged in as owner space" do
scenario "returned to space show" do
user = create(:user)
space = create(:space, approved: true)
user.spaces << space
allow_any_instance_of(ApplicationController).to recei... |
require 'rails_helper'
RSpec.describe ArticlesController, type: :controller do
describe '#index' do
it 'renders the index template' do
get :index
expect(response).to render_template(:index)
end
end
describe '#show' do
let(:article) { FactoryBot.create(:article) }
it 'renders the in... |
namespace :sync do
desc "Sync the counter caches"
task :comments => :environment do
posts = OldTextFile.all
posts.each do |post|
OldTextFile.update_counters post.id, :comments_count => post.comments.count
end
end
end |
require 'spec_helper'
feature 'User Registration' do
before do
DatabaseCleaner.clean
end
scenario 'User can create an account, a welcome email is sent and they are logged in' do
visit '/'
emails_sent = ActionMailer::Base.deliveries.length
click_link 'Register'
fill_in 'user[email]', with: ... |
# == Schema Information
#
# Table name: deposits
#
# id :integer not null, primary key
# brokers_lead_id :integer
# amount :integer
# currency :string
# created_at :datetime
# updated_at :datetime
#
class Deposit <ActiveRecord::Base
validates_presence_of :... |
module ApplicationHelper
# Render the user profile picture depending on the gravatar configuration.
def user_image_tag(email)
if APP_CONFIG.enabled?("gravatar") && !email.nil? && !email.empty?
gravatar_image_tag(email)
else
image_tag "user.svg", class: "user-picture"
end
end
# Render th... |
# frozen_string_literal: true
class HousePresenter < ApplicationPresenter
def statuses
Enums.house_statuses
end
def street_names
House.all.collect(&:street).uniq
end
def for_select
House.all.each_with_object({}) do |house, acc|
acc[house.street] ||= []
acc[house.street] << [house.nu... |
class AddUnitPriceDiscountsColumnToInvoiceItems < ActiveRecord::Migration[5.2]
def change
add_column :invoice_items, :unit_price_discounted, :integer
end
end
|
class RegistrationsController < ApplicationController
prepend_before_action :require_no_authentication, only: [:new, :create]
layout 'basic'
include Abroaders::Controller::Onboarding
include Auth::Controllers::SignInOut
def new
run Registration::New
render cell(Registration::Cell::New, @model, form:... |
class Language < ActiveRecord::Base
attr_accessible :description,:spanishname, :language_sid
validates :description, :language_sid, :presence => true, :uniqueness => true
end
|
class Question < ApplicationRecord
validates :title,
presence: true,
length: { minimum: 20 }
validates :description,
presence: true,
length: { minimum: 50 },
if: 'markdown.blank?'
validates :markdown,
presence: true,
length: { minimum: 50 },
if: 'description.blank?'
validates :us... |
class CreateRules < ActiveRecord::Migration
def change
create_table :rules do |t|
t.integer :user_id
t.integer :pattern_id
t.string :rule_type
t.string :year
t.string :month
t.string :day
t.string :hour
t.string :variation
t.decimal :value, :pre... |
class Post
include DataMapper::Resource
property :id, Serial # An auto-increment integer key
property :user_id, Integer # An integer key
property :title, String # A varchar type string, for short strings
property :body, Text # A text block, for longer string data.
property :cre... |
class ServiceAreaCode < ApplicationRecord
has_many :ticket_service_area_codes, dependent: :destroy
has_many :tickets, through: :ticket_service_area_codes
end
|
class CreateBlocks < ActiveRecord::Migration[5.0]
def change
create_table :blocks do |t|
t.string :name, :limit => 150, :null => false
t.integer :weight, :null => false, :default => 0
t.references :block_subgroup, foreign_key: true, :null => false
# auto / conditional
t.integer :incl... |
# Imagine a robot sitting on the upper left corner of a grid with r rows and c
# columns. The robot can only move in two directions, right and down, but certain
# cells are "off limits" such that the robot cannot step on them. Design an
# algorithm to find a path for the robot from the top left to the bottom right.
#
#... |
cask "mounty-legacy" do
version "1.9"
sha256 :no_check
url "https://mounty.app/releases/Mounty-1.9.dmg"
name "Mounty for NTFS"
desc "Re-mounts write-protected NTFS volumes"
homepage "https://mounty.app/"
app "Mounty.app"
end
|
require 'elm/compiler/exceptions'
require 'elm/compiler/io'
require 'open3'
require 'tempfile'
module Elm
class Compiler
class << self
def compile(elm_files, output_path: nil, elm_make_path: "elm-make")
raise ExecutableNotFound unless elm_executable_exists?(elm_make_path)
if output_path
... |
module Queries
class ShowUserPortfolio < Queries::BaseQuery
type Types::UserPortfolio, null: true
description "Get the user portfolio"
def resolve
return unless current_user
current_user.user_portfolio
end
end
end
|
# Gitlab::Git::Commit is a wrapper around native Grit::Repository object
# We dont want to use grit objects inside app/
# It helps us easily migrate to rugged in future
require_relative 'encoding_helper'
require_relative 'ref'
require 'open3'
module Gitlab
module Git
class Repository
include Gitlab::Git::P... |
json.credit_item do
json.extract! @credit_item, :id, :stripe_charge_id, :stripe_receipt_url, :memo, :quantity, :user_id
end
|
FactoryBot.define do
factory :buy do
point { Faker::Number.within(range: 1..100) }
association :user
association :item
end
end
|
class WorkoutsController < ApplicationController
get '/log' do
not_logged_in?
current_user
all_workouts = Workout.all.find_all {|workout| workout.user_id == session[:user_id]}
@workouts = all_workouts.sort_by { |workout| workout.date}.reverse
erb :'workouts/logs'
end
... |
class Organizer < ApplicationRecord
belongs_to :microcosm
belongs_to :user
end
|
require 'roby/test/self'
require 'roby/test/aruba_minitest'
module Roby
module CLI
describe 'roby gen' do
include Test::ArubaMinitest
def validate_app_valid(*args)
roby_run = run_roby ["run", *args].join(" ")
run_roby_and_stop "quit --retry"
... |
require "formula"
class Htop < Formula
homepage "http://hisham.hm/htop/"
url "http://hisham.hm/htop/releases/1.0.3/htop-1.0.3.tar.gz"
sha1 "261492274ff4e741e72db1ae904af5766fc14ef4"
def install
system "./configure",
"--disable-debug",
"--disable-dependency-tracking",
"--disable-silent-ru... |
# frozen_string_literal: true
module PaymentGateways
class OgoneCrypt < PaymentGatewayCrypt
DEFAULT_EXPIRATION_DATE = Date.new(2099, 12, 1)
DEFAULT_EXPIRATION_DATE_PARAM = DEFAULT_EXPIRATION_DATE.strftime("%m%y") # "1299"
attr_reader :url
attr_accessor :fields, :field_names, :payment_gateway_option... |
require 'rails_helper'
RSpec.describe User, type: :model do
before do
@user = FactoryBot.build(:user)
end
describe 'ユーザー新規登録' do
context '新規登録できるとき' do
it 'nickname,email,password,password_confirmation,姓,名,姓カナ,名カナ,生年月日が存在すれば登録できる' do
expect(@user).to be_valid
end
it 'emailに@が含まれていると登録できる'... |
class Book
attr_accessor :title
def title
_title = []
_exceptions = ['and', 'the', 'a', 'an', 'in', 'of']
@title.split(' ').map.with_index { |word, idx|
if idx == 0 or !_exceptions.include?(word)
_title << word.capitalize
else
_title << word
end
}
_title.join(' ')
end
end |
module SlackbotPingity
module Commands
class Ping < SlackRubyBot::Commands::Base
command 'ping' do |client, data, match|
request = self.process_input(match['expression'])
client.say(
channel: data.channel,
text: "I'm attempting to ping \"#{request}\". Just a moment, plea... |
class KeepController < ApplicationController
def index
render component: 'Keep'
end
end
|
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
def index
@tracked_trainees = Trainee.all.where(tracking_status: 1)
@submissions = Submission.all
end
end
|
require 'nokogiri'
require 'nokogiri-styles'
class SVGMapper
ORIGINAL_MAP = 'assets/us_map.svg'
XPATH_FOR_COUNTY = "//svg:path[@inkscape:label='%{county}']"
XPATH_NAMESPACES = {'svg': "http://www.w3.org/2000/svg", 'inkscape': "http://www.inkscape.org/namespaces/inkscape"}
def initialize(output_file_name, opts = ... |
class Droid < ActiveRecord::Base
alias_method :orig_as_json, :as_json
def as_json(options = {})
base = orig_as_json
if options[:version] == 2
base = {'name' => self.name}
end
base
end
end
|
class Article < ApplicationRecord
mount_uploader :cover, CoverUploader
validates :title, presence: true, length: { minimum: 5 }
has_many :comments, dependent: :destroy
belongs_to :user
has_many :likes
has_many :users, through: :likes
scope :published, -> { where(published: true) }
scope :most_comm... |
# geocoder gem configuration file
Geocoder.configure do |config|
config.lookup = :yahoo
end
|
# frozen_string_literal: true
# Copyright (c) 2019 Danil Pismenny <danil@brandymint.ru>
require_relative 'base_client'
module Valera
class MonolithosClient < BaseClient
URL = 'https://price.monolithos.pro/v1/setzer/price/list'
# [{"first_currency"=>"ETH", "second_currency"=>"RUB", "price"=>"226330.42591000... |
ActionController::Routing::Routes.draw do |map|
map.resources :statuses, :collection => {
:friends_timeline => :get,
:user_timeline => :get,
:public_timeline => :get,
... |
require 'spec_helper'
require 'harvest/domain' # Because the aggregate roots store EventTypes in Harvest::Domain::Events
require 'harvest/event_handlers/read_models/fishing_grounds_available_to_join'
module Harvest
module EventHandlers
module ReadModels
describe FishingGroundsAvailableToJoin do
le... |
module ApplicationHelper
def today
Date.today.strftime "%d/%m/%Y"
end
def human_date(date)
date.strftime '%d/%m/%y'
end
def label_and_content(label, content, options = nil)
opt = options.to_h
col_md = BootstrapColDecorator.new(opt.fetch :col_md, 0)
col_offset = BootstrapColDecorator.new(... |
require 'discordrb'
require 'colorize'
require 'websocket'
module EasyDiscordrb
class NameBot
attr_accessor :var, :prefixe, :tok
def initialize(variable, token, pref)
@var = variable
@tok = token
@prefixe = pref
end
def Namebot
@var = Discordrb::Commands::CommandBot.new token: tok, prefix... |
require 'spec_helper'
describe DealService do
it 'generates a request uri per centre' do
expect(DealService.request_uri(centre: 'burwood').to_s).to eq "http://deal-service.#{Rails.env}.dbg.westfield.com/api/deal/master/deals.json?centre=burwood"
end
context "Build" do
describe "When we've only asked for... |
require 'digest/md5'
require 'cgi'
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
module Integrations #:nodoc:
module Alipay
module Sign
def verify_sign
sign_type = @params.delete("sign_type")
sign = @params.delete("sign")
email = @params["selle... |
# frozen_string_literal: true
module Telegram
module Bot
module Tasks
extend self
def set_webhook
routes = Rails.application.routes.url_helpers
cert_file = ENV['CERT']
cert = File.open(cert_file) if cert_file
each_bot do |key, bot|
route_name = RoutesHelper.... |
#This class is a rather experimental class designed to gather information
#about the populations evolution during the running of the algorithm
class PopulationMonitor
attr_accessor :stats, :history, :best, :mutations
def initialize *args
@args = *args.join(" ")
@history = []
end
#=--------------Code Ca... |
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
has_many :jobs, dependent: :destroy
has_many :applicat... |
class Project < ActiveRecord::Base
acts_as_superclass
attr_accessible :name, :uid, :description, :scm, :private, :public
belongs_to :owner, class_name: User
validates :name, length: {minimum: 5}, presence: true, uniqueness: true
validates :uid, format: {with: /\A[a-z0-9-]+\z/}, length: {minimum: 5}, presence: tr... |
class CategoriesController < ApplicationController
before_action :authorize
before_action :check_admin
before_action :find_category, except: [:index, :new, :create]
def index
@categories = Category.all
end
def create
@category = Category.new(category_params)
if @category.save
redirect_to categor... |
class Application < ApplicationRecord
validates :name, presence: true
validates :address, presence: true
validates :city, presence: true
validates :state, presence: true
validates :zip, presence: true
has_many :pet_applications
has_many :pets, through: :pet_applications
def self.pending
Application... |
# frozen_string_literal: true
require 'gilded_rose'
def enter_item(name, sell_in, quality)
@items = [Item.new(name, sell_in, quality)]
GildedRose.new(@items).update_quality
end
describe GildedRose do
describe '#update_quality' do
it 'does not change the name' do
enter_item('foo', 0, 0)
expect(@... |
class CreateCrawlers < ActiveRecord::Migration
def change
create_table :crawlers do |t|
t.string :ip_address
t.string :referral
t.string :browser_type
t.boolean :is_it_a_bot
t.date :created_at
t.timestamps null: false
end
end
end
|
require 'spec_helper'
require 'rakuten_web_service/ichiba/ranking'
describe RakutenWebService::Ichiba::RankingItem do
let(:endpoint) { 'https://app.rakuten.co.jp/services/api/IchibaItem/Ranking/20170628' }
let(:affiliate_id) { 'affiliate_id' }
let(:application_id) { 'application_id' }
let(:expected_query) do
... |
#!/usr/bin/env ruby
require 'rubygems'
require 'rubygame'
#require 'pubnub'
require 'matrix'
#require 'pp'
include Rubygame
resolution = [640, 480]
#pn = Pubnub.new(:publish_key => 'pub-dad6a0ed-bc25-4a22-be4d-d4695a6a2b4a', :subscribe_key => 'sub-a391c3ba-08f1-11e2-98f5-8d7cd55b77a3')
@screen = Screen.open resolu... |
class PusherController < ActionController::Base
def pusher
webhook = Pusher.webhook(request)
if webhook.valid?
webhook.events.each do |event|
case event["name"]
when 'channel_occupied'
device = Device.find_or_create_by_channel_name event["channel"]
unless device.unas... |
class ModifySerialFloat < ActiveRecord::Migration[5.2]
def change
change_column :flows_steps, :serial, :float, index: true
end
end
|
require_relative './test_helper'
require './lib/invoice'
require 'time'
require 'bigdecimal'
require 'mocha/minitest'
class InvoiceTest < Minitest::Test
def test_it_exists_and_has_attributes
repo = mock
i = Invoice.new({
:id => 6,
:customer_id => 7,
:merchant_id => 8,
:status... |
require 'rails_helper'
RSpec.describe "FriendlyForwardings", type: :request do
describe "perform a friendly forwarding" do
describe "for non-signed-in users" do
it "should forward to the requested page after signin" do
user = create(:user)
visit edit_user_path(user)
fill_in "session_email", :with... |
class RemoveCategoryRequiredConstraintOnArticles < ActiveRecord::Migration
def self.up
change_column :articles, :article_category_id, :integer, :null => true
end
def self.down
end
end
|
class MateriaCarrerasController < ApplicationController
before_action :set_materia_carrera, only: [:show, :edit, :update, :destroy]
# GET /materia_carreras
# GET /materia_carreras.json
def index
@materia_carreras = MateriaCarrera.all
end
# GET /materia_carreras/1
# GET /materia_carreras/1.json
def... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.