text stringlengths 10 2.61M |
|---|
#!/usr/bin/env ruby
# Typical use:
# t = Templator.new
# t.interpolate_files_like("database.yml") # interpolate database.yml.tmpl into database.yml
# t.interpolate_files_like("database.yml", "production") # interpolate database.yml.tmpl.production files into database.yml
# t.with_directory("mydir").interpolate!("datab... |
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
ActionController::Parameters.permit_all_parameters = true
CMD_START = 10
CMD_CLOSE = 11
CMD_SYNC = 20
CMD_WRITE_CONF = 30
CMD_KILL = 40
FTP_SERVER_PORT = 5005
CONF_FILE_PATH = Rails.... |
# encoding: utf-8
$: << 'RspecTests/Generated/url_query'
require 'rspec'
require 'generated/url'
include UrlModule
describe Queries do
before(:all) do
@base_url = ENV['StubServerURI']
dummyToken = 'dummy12321343423'
@credentials = MsRest::TokenCredentials.new(dummyToken)
client... |
require "rails_helper"
RSpec.describe User, type: :model do
subject {FactoryBot.create :user}
let(:comments) {FactoryBot.create :comments}
describe "Create" do
it { is_expected.to be_valid }
end
it "has a valid" do
expect(subject).to be_valid
end
it "is invalid without a email" do
subject... |
# == Schema Information
#
# Table name: orders
#
# id :integer not null, primary key
# user_id :integer
# total :decimal(, )
# created_at :datetime not null
# updated_at :datetime not null
#
class OrderSerializer < ActiveModel::Serializer
attributes :id, :total
has_man... |
class AddPlayerNumber < ActiveRecord::Migration
def up
add_column :users, :number, :integer
end
def down
remove_column :users, :number
end
end
|
# The error shown says the following to me:
# The error looks to be on line 2.
# You have an open "{" with a trailing ")" and the program is expecting a trailing "}" instead.
# Replace ")" with "}" to resolve this issue.
|
require 'spec_helper'
describe Business do
it { should have_many(:deals) }
it { should validate_presence_of :name }
it { should validate_presence_of :email }
it { should validate_uniqueness_of :email }
it { should_not allow_value("mickey.com").for(:email) }
context "email validation" do
it "recognises wh... |
module API
module V1
class ChallengesSubscriptions < API::V1::Base
before do
authenticate_user
end
namespace :challenges do
route_param :id do
namespace :subscriptions do
paginated_endpoint do
desc 'list all subscriptions of a given challenge... |
# frozen_string_literal: true
module AccountsHelper
def account_input(form)
hint = t("facility_order_details.edit.label.account_owner_html", owner: @order_detail.account.owner_user)
form.input :account, hint: hint do
form.select :account_id, available_accounts_options, include_blank: false, disabled: ... |
module SheetSync
module Download
class ReviewerFinder
def initialize(row)
@row = row
end
def find
User.find_by(name: row.reviewer) || User.create(name: row.reviewer)
end
private
attr_reader :row
end
end
end
|
module Enumerable
def my_each
for i in self
yield(i)
end
end
def my_each_with_index
index = 0
for i in self
yield(i,index)
index+=1
end
end
def my_select
selected = []
for i in self
selected... |
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe StaticPage do
describe 'class methods' do
it 'returns a list of names' do
expect { create(:static_page, name: 'new static page') }.to(
change { described_class.names }.from([]).to(['new static page'])
)
end
end
desc... |
class Charity < ActiveRecord::Base
has_one :user, :as => :role
has_and_belongs_to_many :tags
has_and_belongs_to_many :campaigns
validates :ein, :presence => true, :uniqueness => true
validates :name, :presence => true
geocoded_by :full_street_address
#geocode on save if address changed
#after_validat... |
class RelHeroDividesController < ApplicationController
load_and_authorize_resource
def show
end
def create
if @rel_hero_divide.save
render json: @rel_hero_divide.to_json(:include => :divide), status: :ok
else
render json: @rel_hero_divide.errors.full_messages, status: :unprocessable_entity... |
class Player
attr_reader :player1, :player2
def initialize
get_player_names
end
def both_players
[:player1, :player2]
end
def get_player_names
puts "Player 1. Please enter your name"
@player1 = gets.chomp
puts "Player 2. Please enter your name"
@player2 = gets.chomp
end
end
class GamePieces
attr... |
class ClippingSerializer < ActiveModel::Serializer
attributes :id, :collection_id, :article_id
has_one :collection
has_one :article
end
|
# frozen_string_literal: true
module Mobile
module V0
module Appointments
# Connect's to VAMF's VA appointment and Community Care appointment services.
#
# @example create a new instance and call the get_appointment's endpoint
# service = Mobile::V0::Appointments::Service.new(user)
... |
class Song < ActiveRecord::Base
validates :title, presence: true
validates :released, inclusion: {in:[true, false]}
validates :release_year, presence: true, if: :song_released?
validate :valid_release_year?, if: :song_released?
validates :artist_name, presence: true
validate :song_already_made?
def song_... |
require_relative 'word_guessing_game'
describe Game do
let(:word) { Game.new("apple") }
it "stores length of word" do
expect(word.word_length).to eq 5
end
it "checks how many times letter is in word" do
expect(word.check_letter("p")).to eq 2
end
it "checks index of letter in word" do
expec... |
require File.expand_path(File.dirname(__FILE__) + "/../../../../spec_helper")
describe ControllerGenerator do
it "paths to simple model name" do
ControllerGenerator.new("product", build_attributes).path.should == "/products"
end
it "paths to compound model name" do
ControllerGenerator.new("orderItem", ... |
class Api::ScoresController < ApplicationController
def create
@score = Score.new(score_params)
@score.author_id = current_user.id
if @score.save
render :show
else
render @score.errors.full_messages, status: 401
end
end
def show
@score = Score.find(params[:id])
render :show
end
def index
... |
class User < ApplicationRecord
has_many :students
has_many :teachers, through: :students
validates :username, :email, presence: true
validates :username, :email, uniqueness: true
validates_uniqueness_of :uid, conditions: -> { where.not(uid: nil) }
validates_presence_of :password_digest, conditions: -> {... |
require 'settingslogic'
module Keyrod
class Settings < Settingslogic
config_file = 'keyrod.yml'
source "#{ENV['HOME']}/.keyrod/#{config_file}"\
if File.exist?("#{ENV['HOME']}/.keyrod/#{config_file}")
source "/etc/keyrod/#{config_file}"\
if File.exist?("/etc/keyrod/#{config_file}")
source "... |
# Leetcode setup
# Given an array of integers, return indices of the two numbers such that they add up to a specific target.
# You may assume that each input would have exactly one solution, and you may not use the same element twice.
# param {Integer[]} nums
# param {Integer} target
# return {Integer[]}
def two_sum(... |
class Item < ApplicationRecord
has_and_belongs_to_many :orders
mount_uploader :image, ItemUploader
scope :by_company, -> (company){where(company: company)}
scope :active, ->{where(active: true)}
end
|
class PSD
class Util
# Ensures value is a multiple of 2
def self.pad2(i)
((i + 1) / 2) * 2
end
# Ensures value is a multiple of 4
def self.pad4(i)
i - (i.modulo(4)) + 3
end
def self.clamp(num, min, max)
[min, num, max].sort[1]
end
end
end |
class ChangeColumnRequestsTables < ActiveRecord::Migration
def change
remove_column :stop_requests, :driver_id
remove_column :location_requests, :driver_id
end
end
|
class User < ApplicationRecord
enum status: [:one_way, :matched, :rejected]
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :validatable
belongs... |
desc "Refresh the app with friends from twitter"
task :refresh_tweets => :environment do
RUBYFRIENDS_APP.refresh_tweets
end
desc "Refresh tweets every minute"
task :refresh_tweets_worker => :environment do
loop do
RUBYFRIENDS_APP.refresh_tweets
puts "Sleeping for 60 seconds..."
sleep 60
end
end
|
class User < ActiveRecord::Base
has_many :sends, :class_name => 'Transfer', :foreign_key => 'sender_id'
has_many :receives, :class_name => 'Transfer', :foreign_key => 'receiver_id'
end
|
namespace :style do
desc 'update section to draw divider'
task :update_section_to_draw_divider =>:environment do
Section.all.each do |section|
section.update_config_file_to_draw_divider
end
end
desc 'update section not to draw divider'
task :update_section_not_to_draw_divider =>:environment ... |
class ItemAvailability
attr_accessor :max_adults, :item, :quantity
def initialize args
args.each do |k,v|
instance_variable_set("@#{k}", v) unless v.nil?
end
end
def ==(other_object)
item == other_object.item &&
max_adults == other_object.max_adults &&
quantity == other_object.quanti... |
# Create directory to store keytab files
directory node[:bcpc][:hadoop][:kerberos][:keytab][:dir] do
owner "root"
group "root"
recursive true
mode 0755
only_if { node[:bcpc][:hadoop][:kerberos][:enable] }
end
|
#! /usr/bin/env ruby
require 'json'
require 'yaml'
require 'bundler'
Bundler.require
class App < Sinatra::Base
set :server, :puma
set :default_charset, 'utf-8'
WEATHER_API_HOST = 'http://weather.livedoor.com'
WEATHER_API_PATH = '/forecast/webservice/json/v1'
before do
@japan = YAML.load_file('japan.yml... |
require 'securerandom'
class Retrieval < ActiveRecord::Base
include ActionView::Helpers::TextHelper
belongs_to :user
store :jsondata, coder: JSON
after_save :update_access_configurations
obfuscate_id spin: 53465485
def portal
return @portal if @portal
if jsondata && jsondata['query']
query... |
require 'rails_helper'
include RandomData
RSpec.describe SponsoredpostsController, type: :controller do
let (:my_topic) { Topic.create!(name: RandomData.random_sentence, description: RandomData.random_paragraph) }
let(:my_sponsoredpost) { my_topic.sponsoredposts.create!(title: RandomData.random_sentence, body: Ra... |
class ThiefsController < ApplicationController
before_action :set_thief, only: [:show, :edit, :update, :destroy]
# GET /thiefs
# GET /thiefs.json
def index
@thiefs = Thief.all
respond_to do |format|
format.xlsx {
response.headers[
'Content-Disposition'
] = "attachment;... |
# == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# first_name :string(255) not null
# last_name :string(255) not null
# email :string(255) not null
# password_digest :string(255) not null
# session_token :string(25... |
require 'fileutils'
RSpec::Matchers.define :have_migration do |migration_name|
match do
migrations_directory = Pathname.new(Dir.pwd).join('db', 'migrate')
pattrn = /\A#{migrations_directory}\/(\d+)_#{migration_name}.rb\z/
Dir[migrations_directory.join('**', '*')]
.select { |entry| entry =~ pattrn }... |
class ShoppingCenter < ApplicationRecord
validates :name, presence: true, length: { maximum: 50 }
validates :address, allow_blank: true, length: { maximum: 50 }
validates :parking_area, allow_blank: true, length: { maximum: 50 }
has_many :shops
scope :search_by_keywords, -> (keywords)... |
require "base_stitch"
class RepeatInstruction < BaseStitch
attr_reader :repeat
attr_reader :children
def initialize(repeat, children = [])
@repeat = repeat
@children = children
end
def make
instructions = []
@repeat.times { |_i| instructions << @children.map(&:make).join(" ") }
instru... |
require 'spec_helper'
describe Simplemsg::Msg do
#it 'has a version number' do
# expect(Simplemsg::VERSION).not_to be nil
#end
subject = Simplemsg::Msg.new
describe '#process' do
let(:input) { 'Today is a Good Friday' }
let(:output) { subject.process(input) }
it 'converts to lowercase' do
... |
require_relative '../app/rock'
describe Rock do
let(:rock) {Rock.new}
it "should have a name" do
expect(rock.name).to eq("Rock")
end
it "should beat scissors" do
expect(rock.beat_scissors).to be true
end
it "should beat lizard" do
expect(rock.beat_lizard).to be true
end
it "shouldn't beat paper" do... |
require_dependency 'application_controller'
#require File.join(File.dirname(__FILE__), 'vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu')
#require File.join(File.dirname(__FILE__), 'vendor/will_paginate/lib/will_paginate')
#require File.join(File.dirname(__FILE__), 'vendor/will_paginate/lib/will_paginate/vi... |
require 'chemistry/element'
Chemistry::Element.define "Vanadium" do
symbol "V"
atomic_number 23
atomic_weight 50.9415
melting_point '2175K'
end
|
class Brand < ActiveRecord::Base
has_and_belongs_to_many(:stores)
validates(:name, :presence => true)
before_save(:capitalize_name)
private
define_method(:capitalize_name) do
check_words = ["a","an","the","and","but","or","for","nor", "aboard",
"about","above","across","after","against","along","amid","am... |
class ImSoDumb < ActiveRecord::Migration[4.2]
def change
rename_column :costume_stores, :costume_invetory, :costume_inventory
end
end
|
class IncomingServiceTax < ActiveRecord::Base
validates_presence_of :client_id, :event_total, :service_tax, :invoice_date, :invoice_number
def index(s_date, e_date)
if !s_date.to_s.empty? && !e_date.to_s.empty?
@s_date = Date.parse(s_date, '%d/%m/%Y')
@e_date = Date.parse(e_date, '%d/%m/%Y')
... |
class RemoveCommonOptionToStageOrders < ActiveRecord::Migration[4.2]
def change
remove_column :stage_orders, :own_equipment
remove_column :stage_orders, :bgm
remove_column :stage_orders, :camera_permittion
remove_column :stage_orders, :loud_sound
end
end
|
# frozen_string_literal: true
require 'jiji/test/test_configuration'
require 'jiji/test/data_builder'
describe Jiji::Model::Trading::Utils::CounterPairResolver do
include_context 'use data_builder'
let(:pairs) do
pairs = double('mock pairs')
allow(pairs).to receive(:all).and_return([
Jiji::Model::Tr... |
# The brains behind the drinks, inherant to applictionController
class DrinksController < ApplicationController
# before helper when a user is logged in, only alow them to create records in the db
before_action :require_login, :only => :create
# method defined as index, list all instances of Drink
def index
@dr... |
class PeselValidate
attr_reader(:pesel)
def initialize(str1)
error_msg = """PESEL must be a 11 chars long string made out of numbers.
Instead got: #{str1}\n Type of: #{str1.class} """
raise ArgumentError.new(error_msg) if str1 !~ /^[0-9]{11}$/
@pesel = str1
end
def validate
@pese... |
class AddTwitterSearchToEvents < ActiveRecord::Migration
def change
add_column :events, :twitter_search, :string
end
end
|
=begin
===============================================================================
Custom Collapse Effects V1.6 (01/8/2015)
-------------------------------------------------------------------------------
Created By: Shadowmaster/Shadowmaster9000/Shadowpasta(www.crimson-castle.co.uk)
================================... |
class Api::V1::Merchants::ItemsController < ApplicationController
before_action :set_merchant
def index
render json: ItemSerializer.new(@merchant.items)
end
private
def set_merchant
@merchant = Merchant.find(params["merchant_id"])
end
end
|
class PostsController < ApplicationController
POST_TYPE_PATTERN = /\/(articles|tweets|quotes|pictures|links|snippets|posts)(\.rss)?\/?/i
rescue_from ActiveRecord::RecordNotFound, :with => :not_found
before_filter :redirect_to_admin, :if => :logged_in?
caches_page :index
caches_page :show
# GET /... |
class CreateGenerations < ActiveRecord::Migration[5.2]
def change
create_table :generations do |t|
t.string :gen_name
t.string :region_name
t.string :debuting_pokemon
t.string :game
t.timestamps
end
end
end
|
Then(/^I verify the username format set on User Experience Management page$/) do
$showemail = @userexperiencemanagementpage.showuseremail.value == 'true'? true : false
$showfullname = @userexperiencemanagementpage.showuserfullname.value == 'true'? true : false
$shownickname = @userexperiencemanagementpage.showuse... |
# Helper Method
def position_taken?(board, index)
!(board[index].nil? || board[index] == " ")
end
# Define your WIN_COMBINATIONS constant
WIN_COMBINATIONS= [
[0,1,2], #top row
[3,4,5], #middle row
[6,7,8], #bottom row
[0,3,6], #1st col
[1,4,7], #2nd col
[2,5,8], #3rd col
[0,4,8], #left diagonals
[2,4... |
# frozen_string_literal: true
# == Schema Information
#
# Table name: ad_media # 広告媒体マスターテーブル
#
# id :bigint not null, primary key
# name(媒体名) :string not null
# created_at :datetime not null
# updated_at :datetime not null
# company_id(企業I... |
class ChangecontactnodatatypeInInvoices < ActiveRecord::Migration[5.0]
def change
change_column :buyers, :contact_num, :string
end
end
|
class CreateActivities < ActiveRecord::Migration
def self.up
create_table :activities do |t|
t.integer :id, :user_id
t.text :content, :response
t.boolean :success
t.timestamps
end
add_index :activities, :user_id
end
def self.down
remove_index :activities, :column => :user_... |
module Repositories
module Workers
class ScanRepositories
include Sidekiq::Worker
sidekiq_options queue: 'repositories', retry: true
def perform
Repository.find_each do |repo|
Repositories::Workers::ScanRepository.perform_async(repo.id)
end
end
end
end
end
|
module Teskal
module VERSION #:nodoc:
MAJOR = 0
MINOR = 7
TINY = 4
STRING= [MAJOR, MINOR, TINY].join('.')
def self.to_s; STRING end
end
end
|
require 'spec_helper'
describe 'puppet_url_without_modules' do
let(:msg) { 'puppet:// URL without modules/ found' }
context 'puppet:// url with modules' do
let(:code) { "'puppet:///modules/foo'" }
it 'should not detect any problems' do
expect(problems).to have(0).problems
end
end
context '... |
# encoding: UTF-8
class Outcome < ActiveRecord::Base
validates :title, presence: true
has_many :review_decisions
end
|
class Array
define_method(:queen_attack?) do |enemy|
horizontally_aligned = at(1).eql?(enemy.at(1))
vertically_aligned = at(0).eql?(enemy.at(0))
diagonally_aligned = at(1).-(at(0)).eql?(enemy.at(1).-(enemy.at(0)))
horizontally_aligned.|(vertically_aligned).|(diagonally_aligned)
end
end |
class CommentsController < ApplicationController
def new
@comment = Comment.new
end
def create
@concert=MusicConcert.find_by(id: params[:music_concert_id])
@comment=@concert.comments.new(params_comment)
if @comment.save
redirect_to music_concert_path(@concert)
end
end
private
def params_comment
p... |
module Entities
module User
class Info < Base
expose :nickname, :email
end
end
end
|
require "date"
class ShoppingCart
def initialize
@items = []
end
def add_item(item)
#add items to cart method
@items.push(item)
end
def checkout
total = 0
@items.each do |item|
total = total + item.price
end
total
end
end
class Item
def initialize (name, price)
@name = name
@pr... |
module FacilitiesManagement::BuildingsHelper
def address?(building)
return false if building.blank?
building.address_town || building.address_line_1 || building.address_postcode || building.address_region
end
def address_in_a_line(building)
[building.address_line_1, building.address_line_2, building... |
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe MaintainersController do
describe "routing" do
it "should route /Sisyphus/maintainers/icesik to maintainers#show" do
{ :get => "/Sisyphus/maintainers/icesik" }.should route_to(:controller => 'maintainers',
... |
module KTorrent
class Torrent
attr_reader :manager, :properties, :data, :trackers, :peers
def initialize(manager:, metadata:)
@manager = manager
@properties = ::KTorrent::Torrent::Properties.new(metadata: metadata)
# TODO: Lookup @info.info_hash in persistent store
@data = DataManage... |
module Airstream
class Device
attr_reader :player, :video_title
def initialize(receiver)
@receiver = receiver
end
def file=(file)
if file.class == Video
self.video = file
# when
# TODO Image then self.image = file
else
raise "Unknown file type send ... |
require 'rails_helper'
feature 'user adds a game', %{
As an authenticated user
I want to add a completed game
So that I can keep track of who I've played and the results
Acceptance Criteria
[x] I must be authenticated to post new game
[x] I must provide a second player for the game
[x] I must provi... |
require 'rails_helper'
require_relative '../helpers/session_helpers'
feature 'reviewing' do
include SessionHelpers
before do
visit('/')
sign_up
end
scenario 'allows users to leave a review using a form' do
make_restaurant
click_link('Sign out')
sign_up_two
click_link 'Review KFC'
fill_in 'Thoughts... |
require 'simple_jsonapi/definition/concerns/has_links_object'
require 'simple_jsonapi/definition/concerns/has_meta_object'
# Defines how a portion of a rendered JSONAPI document is generated from a
# resource or error object. See {file:README.md} for more details.
#
# @abstract
class SimpleJsonapi::Definition::Base
... |
require "sinatra"
require "thin"
require "pyroscope"
Pyroscope.configure do |config|
config.app_name = "ride-sharing-app"
config.server_address = "http://pyroscope:4040"
config.tags = {
"region": ENV["REGION"],
}
end
def work(n)
i = 0
start_time = Time.new
while Time.new - start_time < n do
i +... |
SERVER = '10.144.85.40'
PORT = 3000
ITERATIONS = 5
DEFAULT_NUM_CONNECTIONS = 2000
MULTI_QUERIES = 10
def do_httperf(uri, num_conns)
command = <<BASH
httperf --hog \
--server #{SERVER} \
--port #{PORT} \
--uri "#{uri}" \
--num-conns #{num_conns}
BASH
`#{command}`
end
class ParseHttp... |
class Delivery < ApplicationRecord
has_one :order, dependent: :destroy
belongs_to :order
validates :delivery_address, presence: true
end
|
# frozen_string_literal: true
require "rails_helper"
RSpec.describe Arclight::Parent do
describe "#global_id" do
it "returns just the ID" do
parent = described_class.new(id: "test", label: "Test", eadid: "2", level: 2)
expect(parent.global_id).to eq "test"
end
end
end
|
module Merb
module Static
class CookieJar
# :api: private
def initialize
@jars = {}
end
# :api: private
def update(jar, uri, raw_cookies)
return unless raw_cookies
# Initialize all the the received cookies
cookies = []
raw_cookies.each do |ra... |
class Admin::LinesController < ApplicationController
access_control do
allow :admin, :all
end
layout "inadmin"
def index
@lines = Line.all
end
def show
@line = Line.find(params[:id])
end
def new
@line = Line.new
end
def create
@line = Line.new(params[:line])
if @line.... |
class AddAlotToPhones < ActiveRecord::Migration
def change
add_column :phones, :timeout, :string
add_column :phones, :congestion, :boolean
add_column :phones, :noanswer, :boolean
add_column :phones, :busy, :boolean
add_column :phones, :chanunavail, :boolean
end
end
|
# Add it up!
# Complete each step below according to the challenge directions and
# include it in this file. Also make sure everything that isn't code
# is commented in the file.
# I worked on this challenge with Lars Johnson.
# 0. total Pseudocode
# make sure all pseudocode is commented out!
#
#
# Input: an arra... |
require 'rails_helper'
RSpec.describe Records::Destroy, type: :api do
describe 'Behavior' do
let!(:record) { create(:record) }
context 'when record with given id exists' do
it 'destroys the record' do
expect do
described_class.call(user: record.user, id: record.id)
end.to cha... |
module ScriptNotifier
module Services
require 'flowdock'
class Flowdock
include Services::Base
def after_initialize
@api_token = payload[:api_token]
@tags = payload[:tags] || []
end
def deliver!
if success
message = "StillAlive PASS: Your s... |
class RemoveExperienceRangeFromJobs < ActiveRecord::Migration[6.0]
def change
remove_reference :jobs, :experience_range, null: false, foreign_key: true
end
end
|
require 'rails_helper'
describe 'Answer API' do
describe 'GET /index' do
it_behaves_like "API Authenticable"
let(:access_token) { create(:access_token) }
let!(:question) { create(:question) }
let!(:answer) { create(:answer, question: question) }
context 'authorized', :lurker do
before { g... |
module MinceDynamoDb # :nodoc:
require 'singleton'
require_relative 'connection'
class DataStore
include Singleton
# Returns the collection, or table, for a given collection name
#
# The schema must be loaded before any queries are made against a collection
# There are a couple ways to do t... |
class RemoveAgeFromDoctors < ActiveRecord::Migration
def change
remove_column :doctors, :age, :integer
end
end
|
# == Schema Information
#
# Table name: photos
#
# id :integer not null, primary key
# image :string
# created_at :datetime not null
# updated_at :datetime not null
# album_id :integer
# comments_count :integer default("0")
# likes_count :in... |
require 'spec_helper'
require 'topicz/commands/help_command'
describe Topicz::Commands::HelpCommand do
it 'prints a list of commands when none is given' do
expect { Topicz::Commands::HelpCommand.new.execute }.to output(/help/).to_stdout
end
it 'prints information on a single command when one is given' do
... |
class Venn < Formula
include Language::Python::Virtualenv
desc "Mix and match virtual environments"
homepage "https://github.com/paysonwallach/venn"
url "https://github.com/paysonwallach/venn/releases/download/0.4.0/venn-0.4.0.tar.gz"
sha256 "14ba6c6582933883ec87face2c88899421206ce593760f540cd2a84af94f2b51"
... |
require 'rails_helper'
require 'swagger_helper'
RSpec.describe 'Movies', type: :request do
before(:each) do
@user = build(:user)
@user1 = FactoryBot.build(:user, email: 'bot@example.com')
@movie = FactoryBot.create(:movie, name: 'bot', rating: 4)
@movie_catalog = FactoryBot.build(:movie_catalog, pric... |
When(/^User clicks lend an item$/) do
click_on('Lend an Item')
end
Then(/^I should see Lend an Item link$/) do
expect(page).to have_content("Lend an Item")
end
Then(/^I should see lend an item header$/) do
expect(page).to have_content("New Item")
end
When(/^User fills in create item form and cl... |
class AddTypeToTopic < ActiveRecord::Migration[5.2]
def change
add_column :topics, :type, :string
end
end
|
module Types
class UserType < Types::BaseObject
field :id, ID, null: false
field :firstName, String, null: false
field :lastName, String, null: false
field :email, String, null: false
field :questions, [Types::QuestionType], null: true
end
def questions
Loaders::HasManyLoader.for(User, :q... |
class Api::PostsController < ApplicationController
protect_from_forgery with: :null_session
def index
page = params[:page].to_i
posts = Post.on_timeline(current_user).limit(5).offset(5*page).order(created_at: 'desc')
render json: posts, each_serializer: PostSerializer
end
def create
@post = P... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.