text stringlengths 10 2.61M |
|---|
require 'rails_helper'
RSpec.describe RelationshipsController, "#Following" do
context "When show following is successful" do
let(:user) { create(:user)}
before do
sign_in(user)
post :show, params: {id: 1}
end
it "Should returns HTTP success code"... |
BasicStarterTemplate::Application.routes.draw do
resources :status_updates
resources :user_profiles
devise_for :users
root 'home#index'
end
|
class AddUpdateDateAndChangeDateInEvaluations < ActiveRecord::Migration
def change
change_column(:evaluations, :evaluation_helpful_rating_count, :integer, null: false, default: 0)
change_column(:evaluations, :evaluation_rating_count, :integer, null: false, default: 0)
add_column(:evaluations, :update_date... |
class UploadProposal < ActiveRecord::Base
audited
belongs_to :proposal
has_attached_file :file,
:storage => :s3,
:url => ":s3_domain_url",
:path => ":class/:attachment/:id_partition/:style/:filename"
do_not_validate_attachment_file_type :file
validates_presence_of :file
end
|
class Parameter < ActiveRecord::Base
enum kind: [:numeric, :dictionary]
has_many :parameter_choices
accepts_nested_attributes_for :parameter_choices, allow_destroy: true
def choices
parameter_choices.map {|pc| pc.title}.join(", ")
end
def choices=(value)
names = value.split(/,/).map{|v| v.gsub("... |
class AppDelegate
attr_accessor :status_menu
def applicationDidFinishLaunching(notification)
@app_name = NSBundle.mainBundle.infoDictionary['CFBundleDisplayName']
@status_menu = NSMenu.new
@status_item = NSStatusBar.systemStatusBar.statusItemWithLength(NSVariableStatusItemLength).init
@status_ite... |
# frozen_string_literal: true
class ApplicationController < ActionController::Base
layout 'embedded_app'
def current_shop
@current_shop ||= Shop.find_by(shopify_domain: cookies[:shopify_domain])
end
end
|
require 'test/unit'
require 'rubygems'
require 'mocha'
module Exceptions
class MissingWordException < StandardError; end
end
# Design a class to represent a dictionary
class Dictionary
# We know that the dictionary starts out empty
def initialize
@dictionary = {}
end
# Don't know yet how I will represen... |
class Surah < ActiveRecord::Base
self.table_name = 'surahs'
has_many :audio_files, foreign_key: :sura_number
end
|
class RenameServiceParametersSetsToServicePlans < ActiveRecord::Migration[5.1]
def change
rename_table :service_parameters_sets, :service_plans
rename_column :service_instances, :service_parameters_set_id, :service_plan_id
end
end
|
class Beer < ActiveRecord::Base
include RatingAverage
belongs_to :brewery
has_many :ratings, dependent: :destroy
def to_s
"#{name} #{brewery.name}"
end
def average
if ratings.count == 0
return 0
end
ratings.map{ |r| r.score }.sum / ratings.count.to_f
end
end
|
# encoding: utf-8
module Glyph
# A subclass of Glyph::SyntaxNode is instantiated by Glyph::Parser whenever a known
# text element is parsed.
# @since 0.3.0
class SyntaxNode < Node
# @return [String] an empty string
# @since 0.3.0
def to_s
""
end
# @return [String] a textual representation of self
... |
module GetAddress
class Configuration
attr_accessor :api_key, :format_array, :sort
def initialize
@format_array = false
@sort = true
end
def keymap=(mappings)
mappings.each do |old_mapping, new_mapping|
keymap[new_mapping] = keymap.delete(old_mapping)
end
... |
#!/usr/bin/env ruby
# :title: PlanR::TokenStream
=begin rdoc
(c) Copyright 2016 Thoughtgang <http://www.thoughtgang.org>
=end
module PlanR
=begin rdoc
Output of :tokenize_doc plugin specification.
=end
class TokenStream < Array
=begin rdoc
ParsedDocument object the tokenstream is associated with.
=end
attr_rea... |
# frozen_string_literal: true
require 'securerandom'
module Brigitte
#
# A Player in Brigitte has a:
# +hand+ where from player can only throw cards from
# +visible_cards+ where from player can draw from if hands are empty
# +blind_cards+ cards that are face down where from player can take only one
# if a... |
class ChangeUnlikesInImages < ActiveRecord::Migration
def up
change_column :images, :unlikes, :string
end
def down
change_column :images, :unlikes, :integer
end
end
|
class PlanTag < ApplicationRecord
validates :plan_id, presence: true, uniqueness: { scope: :tag_id }
validates :tag_id, presence: true, uniqueness: { scope: :plan_id }
belongs_to :tag
belongs_to :plan
end
|
require 'rspec'
class StringCalculator
attr_reader :delimiters, :numbers
def initialize(string)
@delimiters = extract_delimiters(string)
@numbers = extract_numbers(string)
end
def extract_delimiters(string)
if delimiter = (string.match(%r{^\/\/\[(.+)\]\\n}) && $1)
delimiter.split(']... |
class EmptyController < ApplicationController
def show
redirect_to Empty.name
end
end
|
require 'net/http'
require 'json'
require 'time'
JENKINS_URI = URI.parse("http://10.1.10.238:8080")
JENKINS_AUTH = {
'name' => 'admin',
'password' => 'admin'
}
# the key of this mapping must be a unique identifier for your job, the according value must be the name that is specified in jenkins
job_mapping = {... |
class User < ActiveRecord::Base
has_one :member
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable,
# :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
# Set... |
class AddDeletedAtToRentItems < ActiveRecord::Migration[5.2]
def change
add_column :rent_items, :deleted_at, :datetime
add_index :rent_items, :deleted_at
end
end
|
def link_to_category(name)
"<a href='\/categories/" + name + "'>" + name.gsub(/-/, " / ") + "</a>"
end
def link_to_post(post)
"<a href='\/posts/" + post.id.to_s + "'>" + post.title + "</a>"
end
def link_to_edit_url(post)
relative_link = "\/posts/#{post.id}/edit?key=" + post.edit_key
"<a href='" + relative_link + ... |
class DietsController < ApplicationController
skip_before_action(:force_user_sign_in, {:only =>[:index, :show]})
def index
@diets = Diet.all.order({ :diet_name => :desc })
render({ :template => "diets/index.html.erb" })
end
def show
the_id = params.fetch("path_id")
@diet = Diet.where({:id =... |
class Info
include Mongoid::Document
field :y, as: :type
field :t, as: :title
field :d, as: :detail
embedded_in :contact
validates :type, presence: true
validates :title, presence: true
def to_s
"Info{#{type_title}:#{detail}}"
end
def type_title
"#{type}-#{title}"
end
def type_titl... |
module RunPal
class DeleteCommit < UseCase
def run(inputs)
inputs[:commit_id] = inputs[:commit_id] ? inputs[:commit_id].to_i : nil
inputs[:user_id] = inputs[:user_id] ? inputs[:user_id].to_i : nil
commit = RunPal.db.get_commit(inputs[:commit_id])
return failure(:commit_does_not_exist) i... |
require 'spec_helper'
require_relative '../item.rb'
RSpec.describe Item do
subject { described_class.new '001', 'test', 9.99 }
describe '#code' do
it { is_expected.to respond_to :code }
end
describe '#name' do
it { is_expected.to respond_to :name }
end
describe '#price' do
it { is_expected.... |
require 'rails_helper'
feature 'card with expired review_date main page' do
before do
@user = create(:user)
@desk = @user.desks.create(name:'desk1')
@card = @desk.cards.create(original_text:'yRQYnWzskCZUxPwaQupWkiUzKELZ49eM7oWxAQK_ZXw', translated_text: 'yRQYnWzskCZUkjfvkjxPwaQupWkiUzKELZ46549eM7oWxAQK_Z... |
mario_kart_intro = "
MMMMMMMM MMMMMMMM iiii
M:::::::M M:::::::M i::::i
M::::::::M M::::::::M iiii
M:::::::::M M:::::::::M
M::::::::::M M::::::::::M aaaaaaaaaaa... |
require "test_helper"
class TodoListsControllerTest < ActionController::TestCase
def todo_list
@todo_list ||= todo_lists :one
end
def test_index
get :index
assert_response :success
assert_not_nil assigns(:todo_lists)
end
def test_new
get :new
assert_response :success
end
def t... |
class UsersController < ApplicationController
# load_and_authorize_resource
skip_before_filter :require_login
def index
@users = User.all
end
def show
@user = User.find(params[:id])
end
def new
@user = User.new
end
def create
@user = User.new(params[:user])
if verify_recapt... |
class AddSenhaConfirmationToUsuarios < ActiveRecord::Migration
def change
add_column :usuarios, :senha_confirmation, :string
end
end
|
require 'rails_helper'
RSpec.describe Api::V1::Agents::PasswordsController, type: :controller do
before(:each) do
ActionMailer::Base.delivery_method = :test
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.deliveries = []
@request.env['devise.mapping'] = Devise.mappings[:agent]
end
... |
## por que no hace nada con el javascript
## re hacer el cache porque que no esta funcionando para cuando no hay tweets
get '/' do
erb :index
end
#manda a la vista con los tweets
get '/:username' do
@user = validate_user(params[:username])
@tweets = actualize_tweet_cache
erb :show_tweets
end
#Toma el twitte... |
class FilePreviewsController < ApplicationController
# to use this, go to test.rb and add the line:
# config.assets.debug = true
# but, this'll make it very slow, so be sure to turn it off when
# you don't need it
def show
render text: IO.read(params[:file])
end
end
|
module Referrer
class MarkupGenerator
UTM_KEYS = %w(utm_source utm_medium utm_campaign utm_content utm_term)
ORGANICS = [{host: 'search.daum.net', param: 'q'},
{host: 'search.naver.com', param: 'query'},
{host: 'search.yahoo.com', param: 'p'},
{host: /^(www\.)?g... |
class Trip < ActiveRecord::Base
belongs_to :airport
belongs_to :plane
after_create :generate_name
def generate_name
origin = Airport.find(origin_airport_id)
destination = Airport.find(destination_airport_id)
self.update(trip_name: "#{destination.name}#{origin.name}")
end
... |
class AddTimestampToPlaybacks < ActiveRecord::Migration[5.0]
def change
add_column :playbacks, :played_at, :datetime
end
end
|
require 'spec_helper'
describe "LocationPages" do
subject { page }
before { BikeShareClient.stub(:parsed_json) { KioskResults.example } }
shared_examples "a search form" do
let (:submit) { "Find nearby Kiosks" }
describe "successfuly searching for an address" do
before do
fill_in "locatio... |
# creates helper methods for views
helpers do
# checks if there is a logged in user
def logged_in?
!session[:user_id].nil?
end
# returns the current user that is logged in, or nil if nobody is logged in
def current_user
logged_in? ? User.find_by_id(session[:user_id]) : nil
end
end
|
# def reverse_each_word(string)
# arr = []
# string.split.each do |string|
# arr << string.reverse
# end
# arr.join(" ")
# end
def reverse_each_word(string)
new_arr = []
string.split.collect do |string|
new_arr << string.reverse
end
new_arr.join(" ")
end ... |
class Admin::TrainingTagsController < ApplicationController
layout 'admin'
def index
@training_tags = TrainingTag.all
# 全部厂商培训
@training_tags_itvendors = TrainingTag.all_itvendors
# 全部解决方案培训
@training_tags_solutions = TrainingTag.all_solutions
# 全部通用培训
@training_tags_generals = Training... |
require 'Devenv/app'
module Devenv
class Runner
def initialize( argv, stdin = STDIN, stdout = STDOUT, stderr = STDERR, kernel = Kernel )
@argv, @stdin, @stdout, @stderr, @kernel = argv, stdin, stdout, stderr, kernel
end
def execute!
begin
$stderr = @stderr
$stdin = @stdin
... |
# frozen_string_literal: true
module TransactionContext
# rubocop:disable Metrics/MethodLength
def self.[](*dependencies)
Module.new do
attr_reader :context
def initialize(context: {}, **opts)
@context = context
super
end
dependencies.each do |dependency|
defin... |
class Player
def initialize(name, board)
@name = name.nil? ? get_name : name
@board = board
end
def move
get_move
end
private
def make_move(old_pos, new_pos)
@board.make_move(old_pos, new_pos)#make_move returns false if the move is invalid (true otherwise)
end
def get_move
done ... |
module Roglew
module WGL
IMAGE_BUFFER_LOCK_I3D ||= 0x00000002
IMAGE_BUFFER_MIN_ACCESS_I3D ||= 0x00000001
end
end
module WGL_I3D_image_buffer
module RenderHandle
include Roglew::RenderHandleExtension
functions [
[:wglAssociateImageBufferEventsI3D, [ :pointer, :pointer, :pointer, :poi... |
json.array!(@stock_user_lists) do |stock_user_list|
json.extract! stock_user_list, :id, :lists_id, :users_id
json.url stock_user_list_url(stock_user_list, format: :json)
end
|
class SignupMailer < ApplicationMailer
def signup(email)
@email = email
mail(to: Rails.application.secrets.admin_email, subject: 'New Midwest Dev Chat request.')
end
end
|
class Payment < ActiveRecord::Base
attr_accessor :payment_type
#validation
validate :validate_uniqueness_transaction_referense
#relationships
belongs_to :payee, :polymorphic => true
has_many :finance_payments
serialize :gateway_response
def validate_uniqueness_transaction_referense
... |
require 'opal'
require 'browser'
require 'browser/socket'
require 'browser/console'
require 'browser/dom'
require 'browser/dom/document'
require 'browser/http'
require 'browser/delay'
require 'native'
puts 'Loading Item...'
class Item
def initialize(binding)
@binding = binding
@node = DOM{
li
}
@node.appe... |
require("minitest/autorun")
require("minitest/rg")
require_relative("../River")
require_relative("../Fish")
require_relative("../Bear")
class TestRiver < MiniTest::Test
def setup
@fish1 = Fish.new("Salmon")
@river = River.new("Amazon", @fish1)
end
# check the river fish population
def test_has_a_fish
assert_equal(1,... |
class EnterName < Chingu::GameStates::EnterName
def initialize(**options)
self.input = { q: proc { pop_game_state } }
super
PulsatingText.create('Introduce Un Nombre', x: $window.width / 2, y: 45, size: 70)
Chingu::Text.create('Maximo 18 Caracteres', x: $window.width / 2 - 400, y: $window.height - 250... |
require_relative 'p02_hashing'
class HashSet
attr_reader :count
def initialize(num_buckets = 8)
@store = Array.new(num_buckets) { Array.new }
@count = 0
@num_buckets = num_buckets
end
def insert(key)
garbage = key.hash
unless include?(garbage)
self[garbage] << garbage
@count+=... |
class ShortMessagesController < ApplicationController
def inbox
@messages = current_user.received_messages
end
def outbox
@messages = current_user.sent_messages
end
def new
@message = ShortMessage.new :receiver_id => params[:receiver_id]
end
def create
@message = current_user.sent_messa... |
class TimerType < ActiveRecord::Migration
def self.up
add_column :papers, :exam_value, :string
end
def self.down
end
end
|
class GateController < ApplicationController
skip_before_filter :authenticate
def index
end
def login
# Associate with provider account
auth = request.env["omniauth.auth"]
if auth && User.current
User.current.update_with_omniauth(auth)
flash[:info] = "Nomnichi account is associated wit... |
require_relative('../db/sql_runner')
class Car
attr_reader :id, :manufacturer, :model, :condition, :type, :year, :engine,
:transmission, :fuel_type, :description, :stock, :buy_price, :sell_price
def initialize(options)
@id = options['id'].to_i if options['id']
@manufacturer = options['man... |
class VideoUtil
def self.screenshot(origin_path,screenshot_dir,screenshot_count=10)
movie_info = FfmpegMovieInfo.new(origin_path)
if !movie_info.valid?
self.record_encode_fail_log(origin_path)
return false
end
timestamps = movie_info.screenshot_timestamps
timestamps.each_... |
class AddPointsAndPartialAnswers < ActiveRecord::Migration
def self.up
add_column "run_tests", "partial_answer", :string
add_column "runs", "points", :integer
add_column "problems", "scoring_method", :string
end
def self.down
remove_column "run_tests", "partial_answer"
remove_column "runs", "... |
class CategoriesController < ApplicationController
include ApplicationConcern
before_action :set_category, only: %i[show edit update destroy]
def index
@categories = current_user.categories.roots
end
def show; end
def new
@category = current_user.categories.build
@categories = current_user.c... |
class RenameCompaniesToClients < ActiveRecord::Migration
def self.up
rename_table :companies, :clients
end
def self.down
rename_table :clients, :companies
end
end |
class User < ApplicationRecord
has_secure_password
validates :username, uniqueness: { case_sensitive: false }
has_many :puzzles, through: :scores
has_many :scores
end
|
require "rails_helper"
require "rspec_api_documentation/dsl"
describe V1::TokensController do
resource "JSON API - Tokens" do
include_context "with JSON API Headers"
let!(:user) { create :user, email: email, password: "123456" }
let(:jwt_token) { build :jwt_token, user: user }
post "/v1/tokens" do
... |
class Group < ApplicationRecord
has_many :group_user
has_many :users, through: :group_user
has_many :messages
accepts_nested_attributes_for :group_user
end
|
FactoryGirl.define do
factory :article do
title Faker::Lorem.words
text Faker::Lorem.paragraph
end
end
|
#!/usr/bin/env ruby
module Gui
class TextField < Chingu::Text
attr_reader :input
trait :bounding_box
def initialize options = {}
super options
@input = Gosu::TextInput.new
@input.text = @text
@caret_color = options[:caret_color]
end
def update
self.text = @input.text
end
... |
require 'enumerator'
require 'interp'
require 'optparse'
require 'strscan'
class Token
attr_reader :type, :value
def initialize(value)
@value = value
end
%w|number 1paren rparen op|.each do |a|
module_eval %{ def #{a}?; false end }
end
end
class Paren < Token
def initialize(value, type)
sup... |
# encoding: utf-8
require 'tunemygc/network'
require 'optparse'
module TuneMyGc
class CLI
attr_reader :client, :options
def self.start(args)
args = ["-h"] if args.empty?
options = {}
OptionParser.new do |opts|
opts.banner = "Usage: tunemygc [options]"
opts.on("-r ", "--re... |
class PickupSerializer < ActiveModel::Serializer
attributes :id, :address, :city, :pincode, :lat, :lon,
:start_time, :end_time, :total, :status
def start_time
!object.start_time? ? nil : object.start_time.to_i
end
def end_time
!object.end_time? ? nil : object.end_time.to_i
end
def accepted_a... |
class Image < ActiveFedora::Base
include CurationConcern::CaseWork
self.human_readable_short_description = "Any Image work, preferably with VRA xml attached."
self.accept_datastream_attachments ["VRA", "MODS", "QDC"]
end
|
class Person
attr_accessor :teas
attr_reader :name
@@all = []
def initialize(name)
@name = name
@cupboard = {
:black => [],
:green => [],
:oolong => [],
:puerh => [],
:white => [],
:yellow => []}
@@all << self
end
def self.all
@@all
end
... |
require 'spec_helper'
RSpec.describe MarkdownMetrics::Elements::Inline::Image do
let(:line) { "" }
let(:next_line) { nil }
let(:element) { described_class.new(lines: [line, next_line], start_at: 0) }
describe '.match_element' do
it { expect(described_class.match_element(... |
require_relative '../spec_helper'
describe "Bcpc_Hadoop::Hadoop_Helpers" do
describe '#write_placement_xml' do
let(:dummy_class) do
Class.new do
include Bcpc_Hadoop::Hadoop_Helpers
end
end
# Test a simple no attribute, no child placement definition
context '#simple_placement' do
... |
require 'rails_helper'
RSpec.describe DataSource, type: :model do
describe 'validations' do
it 'must have a name' do
expect(subject).to be_invalid
expect(subject.errors[:name]).to include("can't be blank")
end
it 'must have a url' do
expect(subject).to be_invalid
expect(subject.e... |
# frozen_string_literal: true
require_relative 'boot'
require 'rails/all'
require 'csv'
require 'differ/string'
require 'fa'
require 'google_api'
require 'encrypted_keystore'
require 'slack_notification'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.... |
class Admin::ResellersController < ApplicationController
access_control do
allow :admin, :all
end
layout "inadmin"
def index
@resellers = Reseller.all
end
def show
@reseller = Reseller.find(params[:id])
end
def new
@reseller = Reseller.new
end
def create
@reseller = Re... |
# Regresa true si encuentra un numero de cuenta.
print "Proporcione su número de cuenta (deben ser 10 dígitos): "
string = gets.chomp
def format_validate(string)
"VALIDATED" if string =~ (/^\d{4}-\d{3}-\d{3}$/)
end
# Regresa un numero de cuenta si existe dentro del string y nil en el caso contrario.
de... |
class Employee < ActiveRecord::Base
has_many :approvals, :dependent => :destroy
has_many :machines, :through => :approvals
attr_accessible :first_name, :last_name, :machine_ids
end
|
class PasswordsController < ApplicationController
skip_before_action :require_login
def new
@user = nil
end
def create
@user = User.find_by(email: params[:email])
@user.send_password_reset if @user
flash[:notice]="Email sent with password reset instructions."
if... |
Rails.application.routes.draw do
root 'home#index'
resources :elements, only: [:index]
end
|
# rubocop:disable Style/FileName
# via https://github.com/fastlane/fastlane/pull/7202/files
module FastlaneCore
class PTY
def self.spawn(*cmd, &block)
# We have PTY
if Gem::Specification.any? { |s| s.name == "pty" }
require "pty"
PTY.spawn(command) do |stdout, stdin, pid|
blo... |
class MatchCreationService
def initalize
end
def create_matches_for_round(round)
contestant_ids = Contestant.active_contestants_for_tournament(round.tournament_id).pluck(:id)
match_pairing_ids = contestant_ids.each_slice(2).to_a
Match.transaction do
match_pairing_ids.each do |pairing|
... |
class CreateInvestigations < ActiveRecord::Migration
def self.up
create_table :investigations do |t|
t.integer :consultation_id
t.integer :assay_id
t.string :value
t.date :date_of_test
t.timestamps
end
end
def self.down
drop_table :investigations
end
end
|
class AddRenewIdToChurches < ActiveRecord::Migration
def change
add_column :churches, :renew_database_id, :integer
end
end
|
# frozen_string_literal: true
class PostCardComponent < ViewComponent::Base
def initialize(post:)
@post = post
end
end
|
require 'test_helper'
class Users::AssetsControllerTest < ActionDispatch::IntegrationTest
include Devise::Test::IntegrationHelpers
test "should show all the non-deleted pictures" do
sign_in(users(:commissioner))
get user_assets_url(user_id: users(:commissioner).slug)
assert_select('.asset', 1)
ass... |
class LikesController < ApplicationController
before_action :authenticate_user
def create
@user = current_user
@like = Like.new(user: @user, likeable_type: params[:likeable_type], likeable_id: params[:likeable_id])
if @like.save
flash[:success] = "I think I like it!"
redirect_to root_path
else
flash.... |
class URL
attr_accessor :id, :url, :bs_id, :site_id
@@number = 1
def initialize(n=0,m=0)
@id = @@number # URLid
@bs_id = n # BrefingSession#url_id
@site_id = m # EmploymentInformationSite#id
@url = "" # url
@@number += 1
end
def show_data
puts "#{@bs_id},#{@site_id},#{@url}"
end
e... |
class CreateRecips < ActiveRecord::Migration
def change
create_table :recips do |t|
t.string :ing_1
t.string :ing_2
t.string :ing_3
t.string :ing_l
t.timestamps null: false
end
end
end
|
## require 'props'
require 'logutils'
## require 'textutils'
# our own code
require 'linkto/version' # let it always go first
require 'linkto/bing'
require 'linkto/flickr'
require 'linkto/google'
require 'linkto/untappd'
require 'linkto/wikipedia'
module Linkto
def self.banner
"linkto/#{VERSION} on Ru... |
require 'spec_helper'
require 'pry'
module Twoctwop
describe Response do
include_context "data"
let(:response_body) { File.read(File.join(Twoctwop.root, 'spec', 'fixtures', 'response_body.txt')) }
describe "#decrypt_body" do
it "should decrypt the body into xml" do
response = Twoctwop:... |
require 'rubygems'
require 'rake'
require 'pathname'
def get_file_as_string(filename)
data = ''
f = File.open(filename, "r")
f.each_line do |line|
data += line
end
return data
end
desc "Build prolog programm"
task :build do
files = [
"domains.pro",
"database.pro",
"predicates.pro",
"goa... |
class ReAddLineItems < ActiveRecord::Migration[5.0]
def change
create_table :line_items do |t|
t.string "variant_id"
t.string "title"
t.integer "quantity"
t.float "price"
t.float "grams"
t.string "sku"
t.string "variant_title"
t.string "vendor"
... |
require 'spec_helper'
describe Category do
it{should have_many(:videos)}
describe "most_recent" do
it "should list at most six videos" do
Category.create(name: "Fun")
create_video_list(6)
expect(Category.first.recent_videos().size).to eq(6)
end
it "should list newer ones first" do
Category.crea... |
# frozen_string_literal: true
#
# Copyright 2011-2013, Dell
# Copyright 2013-2015, SUSE LINUX GmbH
#
# 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... |
class RushClass < ActiveRecord::Base
has_and_belongs_to_many :users
has_many :recruits
belongs_to :admin, class_name: "User", foreign_key: :admin_id
end
|
require "pry"
def game_hash
game = {
home:
{team_name: "Brooklyn Nets",
colors: ["Black", "White"],
players: {
"Alan Anderson" => {
number: 0,
shoe: 16,
points: 22,
rebounds: 12,
assists: 12,
steals: 3,
blocks: 1,
... |
# frozen_string_literal: true
require 'test_helper'
module Vedeu
module Geometries
describe YDimension do
let(:described) { Vedeu::Geometries::YDimension }
let(:instance) { described.new(attributes) }
let(:attributes) {
{
d: d,
dn: ... |
require 'rails_helper'
RSpec.describe NewsController, type: :controller do
let(:news) { create(:valid_news) }
describe 'GET #index' do
it 'renders index template' do
get :index
is_expected.to render_template(:index)
end
end
describe 'GET #new' do
it 'renders new template' do
get... |
require 'spec_helper'
describe PostCard do
it { should validate_presence_of :name }
it { should validate_presence_of :address_line1 }
it { should validate_presence_of :city }
it { should validate_presence_of :zip }
it { should validate_presence_of :state }
it { should validate_presence_of :country }
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.