text stringlengths 10 2.61M |
|---|
class AddBlockSettingsToMovies < ActiveRecord::Migration
def self.up
add_column :movies, :top_clips_enabled, :boolean
add_column :movies, :top_quotes_enabled, :boolean
add_column :movies, :top_bestsellers_enabled, :boolean
end
def self.down
remove_column :movies, :top_clips_enabled
remove... |
# encoding: utf-8
# puts("我在马路边,捡到一分钱!")
# p 100
=begin
x = 10
y = 20
result = x * x + y * y + 2 * x * y
puts("sono result wa:#{result}")
unless result < 500 then
print("wa!")
end
=end
=begin
names = ["kobayashi", "hayashi", "moli", "li"]
names[0] = "kanna"
p("first name is:#{names[0]}")
=end
=begin
names = ["koba... |
class MailClientsController < ApplicationController
# GET /mail_clients
# GET /mail_clients.xml
def index
if is_logged_in?
@mail_clients = MailClient.all(:order => "last_name ASC, first_name ASC")
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @m... |
module JunosConfig
module Security
class Policy
attr_accessor :raw,
:config,
:name,
:from_zone,
:to_zone
def initialize(config, raw, from_zone, to_zone)
@config = config
@raw = raw
@... |
# A simple example of a Ruby class definition.
class Person
def initialize(firstname, lastname)
@firstname = firstname
@lastname = lastname
end
human = Person.new('kingsley', 'ijomah')
puts human.firstname
puts human.lastname
# attr_reader (manually)
# ================
class Person
def initialize... |
require 'zeus/rails'
require_relative 'spec/support/tests/current_bundle'
class CustomPlan < Zeus::Plan
def initialize
super
@rails_plan = Zeus::Rails.new
end
def boot
ENV['BUNDLE_GEMFILE'] = File.expand_path(
"../gemfiles/#{latest_appraisal}.gemfile",
__FILE__
)
require 'bundle... |
require_relative "battleship"
require_relative "board"
class ComputerPlayer
attr_accessor :player, :board
def initialize(player = nil, board = Board.new)
@player = player
@board = board
end
def get_play
duplicate = true
until duplicate == false
position = board.random_position
un... |
class EditYogaclassesAdd < ActiveRecord::Migration
def change
add_column :yogaclasses, :time, :integer
add_column :yogaclasses, :cost, :integer
end
end
|
class FontBalooThambi2 < Formula
head "https://github.com/google/fonts/raw/main/ofl/baloothambi2/BalooThambi2%5Bwght%5D.ttf", verified: "github.com/google/fonts/"
desc "Baloo Thambi 2"
homepage "https://fonts.google.com/specimen/Baloo+Thambi+2"
def install
(share/"fonts").install "BalooThambi2[wght].ttf"
... |
class Ingredient < ActiveRecord::Base
# has_many_through :SandwichIngredient
# belongs_to :sandwich
has_many :sandwich_ingredients
has_many :sandwiches, :through => :sandwich_ingredients
end
|
# frozen_string_literal: true
class TableOfContentsBuilder
def self.build(document, single_node: false, expanded: false)
new(document, single_node: single_node, expanded: expanded).build
end
attr_reader :document, :single_node
def initialize(document, single_node: false, expanded: false)
@document = d... |
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
def javascript(*files)
content_for(:head) { javascript_include_tag(*files) }
end
def stylesheets(*files)
content_for(:head) { stylesheet_link_t... |
class CreateMailIdDefinitions < ActiveRecord::Migration
def change
create_table :mail_id_definitions do |t|
t.string :from
t.string :cc
t.string :bcc
t.integer :ageing_reminder, default: 0
t.timestamps
end
end
end
|
=begin
Write a method that takes an Array as an argument, and reverses its elements in place; that is, mutate the Array passed in to this method. The return value should be the same Array object.
You may not use Array#reverse or Array#reverse!.
- input: array of elements
- output: same array with elements indices reve... |
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'Show event tickets', type: :request do
context 'successful request' do
let(:event) { create :event }
let(:serializer) { instance_double('::Serializers::EventTickets') }
let(:seriailzed_event) { { 'serialized' => 'event' } }
it 're... |
# frozen_string_literal: true
require 'jiji/test/test_configuration'
describe Jiji::Model::Agents::AgentSource do
include_context 'use data_builder'
include_context 'use container'
let(:repository) { container.lookup(:agent_source_repository) }
context 'コードが空の場合' do
it '新規作成できる' do
agent_source = J... |
class AddQuestionIdToSurveyAnswer < ActiveRecord::Migration[5.2]
def change
add_reference :survey_answers, :survey_questions, index: true, after: :survey_id
end
end
|
#!/usr/bin/env ruby
# rubocop:disable Metrics/LineLength
require 'roo'
require 'json'
require 'securerandom'
require 'uk_postcode'
require 'geocoder'
require 'capybara'
require 'pathname'
require 'yaml'
def bootstrap_supplier_lookup
branch_workbook = Roo::Spreadsheet.open './storage/supply_teachers/input/geographic... |
class FontDomine < Formula
head "https://github.com/google/fonts/raw/main/ofl/domine/Domine%5Bwght%5D.ttf", verified: "github.com/google/fonts/"
desc "Domine"
homepage "https://fonts.google.com/specimen/Domine"
def install
(share/"fonts").install "Domine[wght].ttf"
end
test do
end
end
|
# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
helper :all # include all helpers, all the time
# See ActionController::RequestForgeryProtection for details... |
# frozen_string_literal: true
RSpec.describe 'Sign Up' do
let(:driver) { Selenium::WebDriver::Driver.for :chrome }
let(:waiter) { Selenium::WebDriver::Wait.new }
context 'From home page to sign up page' do
before do
driver.get(HOST)
account_button_element = waiter.until do
driver.find_e... |
class ConsolesWishList < ActiveRecord::Base
self.pluralize_table_names = false
belongs_to :consoles
belongs_to :user
ConsolesWishList.joins(:user, :consoles)
end
|
class Customer < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :validatable
has_many :people
has_many :books, dependent: :de... |
require 'spec_helper'
describe "info_social_networks/index.html.slim" do
before(:each) do
assign(:info_social_networks, [
stub_model(InfoSocialNetwork,
:name => "Info Social Network Name 1",
:description => "Text 1",
:image => "Image File 1"
),
stub_model(InfoSoci... |
require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
require File.expand_path(File.join(File.dirname(__FILE__), 'image_fixtures'))
class DerivedImage < ActiveRecord::Base
saves_attachment
end
class Image < ActiveRecord::Base
FORMATS = {:thumb => [:cover_and_crop, 50, 50],
:med... |
class FixColumnName < ActiveRecord::Migration
def change
rename_column :projects, :author_name, :developer_name
end
end |
$:.push File.expand_path("../lib", __FILE__)
require "beats"
Gem::Specification.new do |s|
s.name = "beats"
s.version = Beats::VERSION
s.author = "Joel Strait"
s.email = "joel dot strait at Google's popular web mail service"
s.homepage = "https://beatsdrummachine.com/"
s.platform = Gem::Platform::RUBY
s.... |
module Mutations
class SetReminder < Mutations::BaseMutation
argument :id, ID, required: true
argument :reminder, Boolean, required: true
field :task, Types::TaskType, null: false
field :errors, [String], null: false
def resolve(id:, reminder:)
task = Task.find_by!(id: id... |
require 'rails_helper'
module ActiveAdmin
describe Resource::Routes do
before { load_defaults! }
describe "route names" do
context "when in the admin namespace" do
let!(:config) { ActiveAdmin.register Category }
let(:category) { Category.new { |c| c.id = 123 } }
it "should r... |
class BooksController < ApplicationController
def index
@all_books = Book.all()
end
end
|
class UploadsController < ApplicationController
def new
@user = User.find(params[:user_id])
@upload = Upload.new
authorize @upload
@upload.user = @user
end
def create
@user = current_user
@upload = Upload.new(upload_params)
@upload.user = User.find(params[:user_id])
authorize @upl... |
require_relative 'main'
require 'yaml'
def save_game(current_game)
filename = prompt_name
return false unless filename
dump = YAML.dump(current_game)
datafile = File.new(File.join(Dir.pwd, "/saved/#{filename}.yaml"), "w")
datafile.puts "#{dump}"
datafile.close
true
end
def prompt_name
begin
file... |
# frozen_string_literal: true
module GraphQL
class Schema
class Field
class ScopeExtension < GraphQL::Schema::FieldExtension
def after_resolve(object:, arguments:, context:, value:, memo:)
if value.nil?
value
else
ret_type = @field.type.unwrap
... |
class CreateBoards < ActiveRecord::Migration
def change
create_table :boards do |t|
t.integer :ident
t.string :url
t.string :name
t.string :description
t.integer :order
t.integer :category
t.boolean :international
t.integer :pages
t.boolean :locked
t.boo... |
Facter.add(:binpathwritable) do
setcode do
kernel = Facter.value(:kernel)
case kernel
when 'Linux'
File.writable?('/usr/local/bin')
else
File.writable?('/usr/bin')
end
end
end
|
# Write a program that solicits 6 numbers from the user, then prints a message that describes whether or not the 6th number appears amongst the first 5 numbers.
# Example:
#
# ==> Enter the 1st number:
# 25
# ==> Enter the 2nd number:
# 15
# ==> Enter the 3rd number:
# 20
# ==> Enter the 4th number:
# 17
# ==> Enter t... |
# encoding: UTF-8
require_relative 'param_holder'
module Creq
module Settings
extend ParamHolder
extend self
parameter :bin, default: 'bin'
parameter :assets, default: 'bin/assets'
parameter :src, default: 'src'
parameter :lib, default: 'lib'
parameter :knb, default: 'knb'
... |
class StoreFood < ApplicationModel
has_many :likes, :conditions => {:object => "StoreFood"}, :foreign_key => "foreign_key"
belongs_to :store, :class_name => "Store", :foreign_key => "store_id"
belongs_to :food, :class_name => "Food", :foreign_key => "food_id"
validates_presence_of :food_id, :store_id
val... |
# frozen_string_literal: true
require_relative 'string_cheese/engine'
require_relative 'string_cheese/helpers/hash'
require_relative 'string_cheese/options'
require_relative 'string_cheese/version'
module StringCheese
extend Helpers::Hash
extend Options
def self.create(attrs = {}, options = {})
create_engi... |
class BankAccount < ApplicationRecord
belongs_to :chapter, inverse_of: :bank_accounts
has_many :outgoing_transactions, class_name: 'BankTransaction', foreign_key: :from_account_id, dependent: :destroy
has_many :incoming_transactions, class_name: 'BankTransaction', foreign_key: :to_account_id, dependent: :destroy... |
class RemoveBairroFimIdFromLogradouros < ActiveRecord::Migration
def change
remove_column :logradouros, :bairro_fim_id, :string
end
end
|
# frozen_string_literal: true
require 'faraday'
require 'json'
require 'net/http'
module TimeOfNeed
class TimeOfNeedService < Common::Client::Base
def initialize
@conn = Faraday.new(:url => Settings.time_of_need.faraday_url)
@request = @conn.post do |req|
req.headers['Content-Type'] = 'appl... |
class Like < ApplicationRecord
belongs_to :opinion
belongs_to :clip
belongs_to :user
end |
require "./src/interface"
describe Interface do
let(:interface) { Interface.new }
let(:router) { spy('router') }
let(:reporter) { spy('reporter') }
subject { router }
context "when calling #place" do
before do
interface.place 1, 2, :north, router
end
it { is_expected.to have_received(:x=)... |
class AddDefaultValueToIsPrivateOnNotes < ActiveRecord::Migration[5.0]
def up
change_column :notes, :is_private, :boolean, default: false
end
def down
change_column :notes, :is_private, :boolean
end
end
|
# http://zzzany.site50.net/http:/zzzany.site50.net/rubyregexp.html
# http://rubyer.me/blog/357/
# http://www.kuqin.com/rubycndocument/man/lanstyle_seiki.html
class Zhengce
# \d
# 数字。即[0-9]
puts "aaa0" =~ /\d/ # 3 匹配数字
puts /\d/ =~ "abc2" # 3
puts "kkmm1" =~ /\d/ # 4 匹配数字
# [\u{4e00}-\u{9fff}]
# 中文
p... |
class CreateManufactures < ActiveRecord::Migration[5.2]
def change
create_table :manufactures do |t|
t.integer :result_no
t.integer :generate_no
t.integer :e_no
t.string :facility_name
t.integer :facility_effect
t.integer :facility_lv
t.integer :facility_e_no
t.stri... |
require_relative '../acceptance_helper'
feature 'User siging in' do
given(:user) { create(:user) }
scenario "existing User Account Login" do
sign_in(user)
expect(page).to have_content 'Вы успешно вошли.'
end
scenario 'non-existent user tries to log in to your account' do
visit new_user_session_p... |
require 'spec_helper'
require 'pushr/message_apns'
describe Pushr::MessageApns do
before(:each) do
Pushr::Core.configure do |config|
config.redis = ConnectionPool.new(size: 1, timeout: 1) { MockRedis.new }
end
end
describe 'next' do
it 'returns next message' do
expect(Pushr::Message.nex... |
require 'rails/generators/base'
require 'securerandom'
module Maini
module Generators
class AuthGenerator < Rails::Generators::Base
source_root File.expand_path("../../templates", __FILE__)
desc "Inicializa ."
def copy_initializer
template "auth.rb", "config/initializers/maini/auth.rb... |
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe Staff::Api::V1::EquipmentsController, type: :controller do
let(:staff) { create(:staff) }
let(:organization) { create(:organization) }
before { sign_in_as(staff) }
describe 'POST #create' do
context 'with valid attributes' do
let(... |
#encoding: utf-8
Dado(/^que eu tenho um usuário não cadastrado$/) do
@user = {
"id" => Faker::Number.hexadecimal(24)
}
end
Quando(/^faço uma consulta$/) do
@result = HTTParty.get("http://ninjarest.herokuapp... |
#
# Author:: Bryan McLellan <btm@loftninjas.org>
# Copyright:: Copyright (c) 2014 Chef Software, Inc.
# License:: Apache License, Version 2.0
#
# 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
#... |
class User < ApplicationRecord
has_many :group_members, as: :member
has_many :groups, through: :group_members
def other_members
self.groups.map{|group| group.all_members_except(self)}
end
end
|
class CreateSigns < ActiveRecord::Migration
def change
create_table :signs do |t|
t.timestamps
t.string :name
t.string :url
end
create_table :categories do |t|
t.timestamps
t.string :name
end
create_table :categories_signs do |t|
t.integer :sign_id
t.int... |
class CreateCanteens < ActiveRecord::Migration
def change
create_table :canteens do |t|
t.string :name_short
t.string :name_full
t.integer :likes_count
t.timestamps
end
end
end
|
# encoding: utf-8
require 'open-uri'
require 'net/http'
require 'pry'
require 'nokogiri'
require 'addressable/uri'
class FundamentalsFetcher
URL_PREFIX = 'https://www.finanzen.net/bilanz_guv/'
def initialize(base_url)
@base_url = base_url
end
def document
@document ||= begin
response = URI.ope... |
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_action :authenticate_user!
before_action :set_paper_trail_whodunnit
before_action :set_treasures_info
before_action :configure_permitted_parameters, if: :devise_controller?
before_action :set_locale
rescue_f... |
class TaxPayment < ActiveRecord::Base
# records tax collected during a transaction
belongs_to :taxed_entity, :polymorphic => true
belongs_to :taxed_fee, :polymorphic => true
belongs_to :finance_transaction
def self.finance_fee_tax_payments(start_date, end_date)
TaxPayment.all(:conditions => ["transacti... |
Rails.application.routes.draw do
devise_for :users
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
#
#
namespace :api, defaults: { format: :json } do
namespace :v1 do
post :authenticate, to: 'authentication#authenticate'
# get :booking_reque... |
#!/usr/bin/env ruby
# This utility copys the newly built files in ../build to the
# `destination_dir`. It's also possible to watch the directory
# so built files are copied automatically.
#
# This was written for ruby 2.5 and requires WSL and the 'listen'
# gem for the directory watching capability.
require('optparse... |
#encoding: utf-8
module Api
module V2
class CommentsController < ::Api::BaseApiController
before_filter :authenticate_user!, :except => [:index]
before_filter :get_user
def index
#params: commentable_id & commentable_type
resource = NoteComment.includes(:user).where(:commentable... |
module Domain
class Ongoing < State
def cancel
Events::Card::ChangedState.new(
id:, board_id:, state: Backlog
)
end
def finish
Events::Card::ChangedState.new(
id:, board_id:, state: Done
)
end
end
end
|
sessions controller
skip_before_filter :login required, :only => :new, :create
def create
user = params[:email]
if user
session[:user_id] = user.id
redirect_to /messageboards/index
else
flash[:notice] = "Failed login"
render :new
end
end
def new
end
def destroy
reset_session
end
-------------------... |
# You are given a list of projects and al ist of dependecies (which is a list of pairs of
# projects, where the first project is dependent on the second project). All of a project's dependencies
# must be built before the project is. Find a build order that will allow the projects to be built. If there
# is no valid bu... |
module Trak
require 'trak/core_ext/blank'
require 'trak/core_ext/round_to_nearest'
require 'trak/time_log'
require 'trak/exit'
TIME_FORMAT_12HOUR = "%-l:%M %p"
TIME_FORMAT_24HOUR = "%-k:%M"
# expects a hash of tasks mapped to time spent, and a sub-report name
# (e.g., work, personal)
# prints a fo... |
class Game < ApplicationRecord
has_many :game_participations
has_many :users, through: :game_participations
def active_player
game_participations.find_by(order: current_player).user
end
def inactive_player
game_participations.where.not(order: current_player).first.user
end
def switch_player... |
class CreateFoods < ActiveRecord::Migration
def change
create_table :foods do |t|
t.float :protein
t.float :carbs
t.float :fiber
t.float :sugar
t.float :fat
t.float :calories
t.float :sodium
t.timestamps null: false
end
end
end
|
RSpec.describe IO::Output do
let(:test_message) { 'test message string' }
describe 'write' do
it 'prints to the stdout' do
expect {
described_class.write(test_message)
}.to output(test_message).to_stdout
end
end
describe 'write_line' do
it 'puts to the stdout' do
expect {... |
# frozen_string_literal: true
class Lesson < AplicationRecord
belongs_to :course
validates :names, presence: true
validates :description, presence: true
end |
require "uri"
require "net/http"
require "json"
module APIUtils
# APIRequest class is to send the request and get the response
# we can send a multiple request and get response for a specific url using APIAccess
class APIRequest
def initialize(url, type='GET', headers=nil,params=nil)
... |
require 'rails_helper'
RSpec.feature "AddNewBookings", type: :feature do
it "should create a new booking with a logged in user" do
login_as create(:user), scope: :user
car = create(:car)
visit "/cars/1"
fill_in "booking_client", with: "Smith"
select Date.tomorrow.year, from: "booking_start_time_1... |
json.array! @contacts do |contact|
json.id contact.id
json.first_name contact.first_name
json.last_name contact.last_name
json.email contact.email
json.phone_number contact.phone_number
json.address contact.address
end
|
PayMe::Application.routes.draw do
resources :payments, only: [:new, :create]
root to: "payments#new"
end
|
class Character < ApplicationRecord
validates :movie_id, :presence => true
validates :actor_id, :presence => true
belongs_to :movie
belongs_to :actor
end
|
describe FaceDetect do
it "has a version number" do
expect(FaceDetect::VERSION).to be_a(String)
end
end
|
# encoding: utf-8
class DeviceType < ActiveRecord::Base
has_many :devices
def avaliable
self.devices.where('client_id is ?',nil).count
end
def unavaliable
self.devices.where("client_id != 'NULL'").count
end
end
|
class PostSerializer < ActiveModel::Serializer
attributes :id, :content, :like_count, :created_at
has_many :likes
has_many :comments
end
|
Pod::Spec.new do |s|
s.name = "MQL201609191100"
s.version = "1.0.1"
s.summary = "client library"
s.description = "client library for iOS (static lib), Supports iPhone Simulator (i386), armv7, armv7s."
s.homepage = "https://github.com/qianlima210210/MQL201609191100"
s.license = "M... |
require_relative '../lib/fizzbuzz.rb'
describe 'Fizzbuzz' do
context 'knows when a number' do
it 'is divisble by 3' do
expect(is_divisible_by?(3, 3)).to be true
end
it 'is NOT divisble by 3' do
expect(is_divisible_by?(1, 3)).to be false
end
it 'is divisble by 5' do
expect(is_div... |
# == Schema Information
#
# Table name: questions
#
# id :bigint(8) not null, primary key
# q_type :text
# description :text
# created_at :datetime not null
# updated_at :datetime not null
# settings :json
# page_id :bigint(8)
#
class Question < ApplicationRecord
... |
class ApplicationController < ActionController::Base
before_action :configure_permitted_parameters, if: :devise_controller?
before_action :check_url
helper_method :update_donations
def after_sign_in_path_for(resource)
donor_path(current_donor)
end
#calculates the total donations for a particular patient
... |
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
Gem::Specification.new do |spec|
spec.name = "fluent-plugin-with-extra-fields-parser"
spec.version = "0.0.1"
spec.authors = ["hiraro"]
spec.email = ["traurig.orz@gmail... |
class Member < ActiveRecord::Base
belongs_to :house
has_many :tasks
validates :first_name, :last_name, :email, :phone_number, :house_id, presence: true
validates :email, uniqueness: true, format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i }
end
|
module Rubii
module Linux
module XDoTool
module KeyEvent
attr_accessor :key
def initialize key, driver=nil
super driver
@key = key
end
def perform driver = @driver, key = @key
super driver
end
end
class MouseMo... |
# -*- encoding : utf-8 -*-
class AddCurrentUpcomingToRecords < ActiveRecord::Migration
def self.up
add_column :exhibitions, :current, :boolean, :default => false
add_column :exhibitions, :upcoming, :boolean, :default => false
add_column :educations, :current, :boolean, :default => false
add_column :ed... |
# encoding: utf-8
require File.dirname(__FILE__) + '/../spec_helper'
describe ApplicationHelper do
describe 'bucket_display_status' do
before do
@bucket = double('bucket', :started_at => nil, :finished_at => nil, :status => 10)
end
it "should return 'pending' if bucket is pending" do
allow(@... |
# frozen_string_literal: true
RSpec.describe Truemail::Client::Configuration do
subject(:configuration_instance) { described_class.new }
let(:host) { FFaker::Internet.domain_name }
let(:token) { create_token }
describe 'defined constants' do
specify { expect(described_class).to be_const_defined(:DEFAULT_... |
require "#{Rails.root}/db/chores/roles_conversion"
describe RolesConversion do
include EnvVarSpecHelper
describe "#ncr_budget_approvers" do
it "should convert NCR budget approvers" do
expect {
RolesConversion.new.ncr_budget_approvers
}.to_not change { User.count }
end
it "should b... |
Rails.application.routes.draw do
root 'service_providers#index'
resources :service_providers, only: [:create, :show, :update] do
resources :consumers, only: [:index, :create, :update, :show]
end
match '/:service_provider_id/oauth2/token', to: 'oauth2/token#create', as: 'oauth2_token', via: [:get, :post]
g... |
class AddNameToUsers < ActiveRecord::Migration
def change
add_column :users,:first_name,:string
add_column :users, :middle_name, :string
add_column :users, :last_name, :string
add_column :users, :user_id, :integer
add_column :users, :relationship, :string
end
end
|
# frozen_string_literal: true
require 'jiji/test/test_configuration'
require 'logger'
describe Jiji::Model::Logging::LoggerFactory do
include_context 'use backtests'
let(:time_source) { Jiji::Utils::TimeSource.new }
let(:logger_factory) { container.lookup(:logger_factory) }
it '同じバックテストのロガーを取得すると同じインスタンスが返さ... |
RSpec.describe TmdbIdRequest do
context "when correct request has been made" do
let(:parameters) {{ media_id: 268,
media_type: "movie",
token: "raNDoMt0K3n"}
}
let(:response) {"{\"adult\":false,
\"backdrop_path\":\"/2b... |
require 'spec_helper'
require 'pp'
describe User do
before { @user = User.new(name: "Example User", email: "user@example.com", password: "foobar", password_confirmation: "foobar", time_zone:'Pacific Time (US & Canada)') }
subject { @user }
it { should respond_to(:name) }
it { should respond_to(:email) ... |
class Date
DAYNAMES = %w(星期日 星期一 星期二 星期三 星期四 星期五 星期六)
ABBR_DAYNAMES = %w(日 一 二 三 四 五 六)
end
class Time
alias :strftime_nolocale :strftime
def strftime(format)
format = format.dup
format.gsub!(/%a/, Date::ABBR_DAYNAMES[self.wday])
format.gsub!(/%A/, Date::DAYNAMES[self.wday])
self.strftime_nolo... |
class FixSurveyReference < ActiveRecord::Migration[6.1]
def change
remove_column :surveys, :project_id
add_column :surveys, :team_project_id, :integer
add_foreign_key :surveys, :team_projects
end
end
|
class MomentumCms::Admin::MenusController < MomentumCms::Admin::BaseController
before_action :load_moment_cms_menu, only: [:edit, :update, :destroy]
before_action :build_moment_cms_menu, only: [:new, :create]
def index
@momentum_cms_menus = @current_momentum_cms_site.menus.all
end
def new
end
def e... |
json.array!(@publishers_tests) do |publishers_test|
json.extract! publishers_test, :id
json.url publishers_test_url(publishers_test, format: :json)
end
|
# frozen_string_literal: true
require 'bigdecimal'
module Tikkie
module Api
# Helper for converting amounts to cents and back.
class Amount
class << self
def from_cents(cents)
amount = BigDecimal(cents) / 100
new(amount)
end
end
def initialize(amount)
... |
class FetchContentWorker
include Sidekiq::Worker
include RateLimitHelper
sidekiq_options :retry => 1, :backtrace => true
def perform(args)
watcher = get_watcher(args['social_watcher_id'])
rate_limit_key = args['rate_limit_key']
rate_limit_time = args['rate_limit_time']
rate_limited(rate_limit... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.