text stringlengths 10 2.61M |
|---|
class CreateArchivedVehiclePositions < ActiveRecord::Migration
def change
create_table :archived_vehicle_positions do |t|
t.integer :vehicle_id
t.integer :trip_id
t.float :curr_lat
t.float :curr_lon
t.datetime :curr_timestamp
t.float :prev_lat
t.float :prev_lon
t.fl... |
require 'spec_helper'
RSpec.describe Procedure::Outcome do
subject(:outcome) { described_class.new(step_classes) }
let(:passed_step) { build_step_class(passed: true) }
let(:failed_step) { build_step_class(passed: false) }
let(:step_classes) { [FakePassedClass, FakeFailedClass] }
context 'passing procedure'... |
require 'rack'
require_relative './lib/controller_base'
require_relative './lib/router'
class Train
attr_reader :origin, :destination, :num_passengers
def self.all
@trains ||= []
end
def initialize(params = {})
@origin = params["origin"]
@destination = params["destination"]
@num_passengers = ... |
class AddMessagesCountToRoom < ActiveRecord::Migration
def change
add_column :rooms, :chats_count, :integer, null: false, default: 0
end
end
|
require "test_helper"
describe User do
# let(:user) { User.new }
#
# it "must be valid" do
# value(user).must_be :valid?
# end
describe "relations" do
before do
user = User.new
end
it "has a list of products" do
user = product(:create)
user.must_respond_to :product
... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "peru/ubuntu-20.04-desktop-amd64"
config.vm.box_version = "20220102.01"
config.vm.synced_folder "data", "/home/vagrant/data", create: true,
owner: "vagrant", group: "vagrant"
config.vm.synced_folder "D:\pelis", "/hom... |
require 'spec_helper'
module Netzke::Basepack
describe ColumnConfig do
it "should implement primary?" do
adapter = Netzke::Basepack::DataAdapters::ActiveRecordAdapter.new(Book)
c = ColumnConfig.new(:id, adapter)
c.primary?.should be_true
c = ColumnConfig.new(:title, adapter)
c.pri... |
Fabricator(:service_attribute_value) do
service_attribute
key { Faker::Lorem.words(1) }
name { Faker::Lorem.words(1) }
end
|
class Book < ApplicationRecord
has_many :book_borrows
end
|
FactoryGirl.define do
factory :request, class: Canvas::API::Request do
end
factory :account_authentication_service, class: Canvas::AccountAuthenticationService do
end
factory :account_report, class: Canvas::AccountReport do
end
factory :account, class: Canvas::Account do
end
factory :admin, class:... |
Spree::Taxon.class_eval do
def applicable_filters(parent_color: nil )
fs = []
# fs << Spree::Core::ProductFilters.child_color_any(parent_color)
# fs << Spree::Core::ProductFilters.parent_and_children_colors_any(taxon: self)
fs << Spree::Core::ProductFilters.parent_color_any(taxon: self)
fs << ... |
class Student < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
has_many :courses
has_many :assessments, through:... |
class Answer < ActiveRecord::Base
belongs_to :answerable, polymorphic: true
end |
Pod::Spec.new do |s|
s.name = 'DMOfferWallSDK'
s.version = '6.1.1'
s.license = 'Domob'
s.summary = 'iOS SDK for Domob OfferWall'
s.homepage = 'http://www.domob.cn/'
s.author = { 'Domob' => 'support@domob.com' }
s.source = { :git => 'https://github.com/gaoyz/DMOfferWallSDK.git', :tag => s.ver... |
class Question
attr_accessor :id, :q, :result
def initialize(params)
puts "Params #{params.inspect}"
@params = params
text = params.split(' ')
@id = text[0]
@q = text[1..text.count].join(' ')
@result = nil
end
def identify
if @q.include? 'which of the following numbers is the larges... |
# -*- encoding: utf-8 -*-
require File.expand_path('../lib/simple-spreadsheet/version', __FILE__)
Gem::Specification.new do |gem|
gem.authors = ["Andrea Mostosi"]
gem.email = ["andrea.mostosi@zenkay.net"]
gem.description = %q{Simple spreadsheet reader for common formats: Excel (.xls, .xlsx), Open... |
require 'perpetuity/retrieval'
require 'perpetuity/mapper'
module Perpetuity
describe Retrieval do
let(:data_source) { double('data_source') }
let(:registry) { double('mapper_registry') }
let(:mapper) { double(collection_name: 'Object', data_source: data_source, mapper_registry: registry) }
let(:quer... |
class BlogPost < AbstractPermalink
belongs_to :user
belongs_to :last_commenter, class_name: "User"
image_accessor :image
attr_accessible :body, :permalink, :status_id, :title, :image_attributes,
:last_commenter_id, :last_commented_at, :comments_count, :user_id,
:image, :tagline, :tags, :tag_ids, ... |
class RemoveFaresFromTickets < ActiveRecord::Migration[6.0]
def change
remove_column :tickets, :fcfare
remove_column :tickets, :bcfare
remove_column :tickets, :ecfare
end
end
|
describe CardSheetFactory do
include_context "db"
let(:factory) { CardSheetFactory.new(db) }
let(:pack_factory) { PackFactory.new(db) }
context "Masterpieces" do
let(:sheet) { factory.masterpieces_for(set_code) }
let(:masterpieces) { sheet.elements.map(&:main_front) }
let(:expected_masterpieces) do... |
# frozen_string_literal: true
module Diplomat
# Methods for interacting with the Consul node API endpoint
class Node < Diplomat::RestClient
@access_methods = %i[get get_all register deregister]
# Get a node by it's key
# @param key [String] the key
# @param options [Hash] :dc string for dc specifi... |
##############################################
#
# gd.rb --Main Code File for Global Destruction.
# (C) Copyright 1992, High Velocity Software, Inc.
# (C) Copyright 2002, Fly-By-Night Software (Ruby Version)
# ... |
class AddTotalTaxAndSubPriceAndTotalPriceAndTotalTaxToOrder < ActiveRecord::Migration
def change
add_column :orders, :total_tax, :float, :default => 0
add_column :orders, :total_price, :float, :default => 0
add_column :orders, :sub_price, :float, :default => 0
rename_column :orders, :tip, :total_tip
end... |
class Admin < ApplicationRecord
has_secure_password
validates :name, presence: true, uniqueness: true
end
|
class CampaignObserver < ActiveRecord::Observer
def after_update(c)
if c.published_state && Time.zone.now.hour.between?(AppConfig.time_window[:start_time], AppConfig.time_window[:end_time]) && eval(AppConfig.day_range).include?(Date.today.wday)
ScheduledMail::MailScheduler.new(c, 'Campaign_now').mail_sch... |
class User < ActiveRecord::Base
has_secure_password
validates :email, presence: true, uniqueness: true
validates :password, confirmation: true, presence: true
validates :password_confirmation, presence: true
validates :password, length: { minimum: 8 }
validates :name, presence: true
def downcase
se... |
class AppointmentNotifier < ActionMailer::Base
def work_confirmation(appointment)
setup_email(appointment, appointment.customer)
@subject = "#{appointment.company.name}: Appointment confirmation"
end
def waitlist_confirmation(appointment)
setup_email(appointment, appointment.customer)
@subject =... |
BookcampingExperiments::Application.routes.draw do
concern :library do
resources :shelves, path: 'ver'
end
# http://stackoverflow.com/questions/7099397/regex-for-any-string-except-www-subdomain
constraints subdomain: /^(?!www).+/ do
root to: 'libraries#dashboard'
end
resources :memberships
resou... |
class RemoveTableUserLists < ActiveRecord::Migration
def change
drop_table :user_lists
end
end
|
class RemoveStringsPhotosFromTables < ActiveRecord::Migration[6.0]
def change
remove_column :instructors, :profile_pic
remove_column :activities, :main_photo
remove_column :activities, :photo_1
remove_column :activities, :photo_2
remove_column :activities, :photo_3
end
end
|
class Notification < ApplicationRecord
belongs_to :receiver, foreign_key: :receiver_id, class_name: 'User'
belongs_to :sender, foreign_key: :sender_id, class_name: 'User'
belongs_to :post, optional: true
belongs_to :response, optional: true
belongs_to :user_tag, optional: true
belongs_to :comment, optional... |
module Bouncer
module Identity
extend self
def config
@config ||= {
host: Bouncer.config.oauth.host
}
end
def links
@links ||= OpenStruct.new.tap do |x|
x.full_logout_path = "/auth/logout"
x.auth_url = "#{config[:host]}"
x.logout_url = ... |
RootLevelType = GraphQL::ObjectType.define do
name 'RootLevel'
description 'Unassociated root object queries'
interfaces [NodeIdentification.interface]
global_id_field :id
connection :comments, CommentType.connection_type do
resolve ->(_object, _args, _ctx){
Comment.all_sorted
}
end
connec... |
require "rails_helper"
describe VelocitasCore::ImportGpx do
let(:url) { "http://www.foo.com/sample.gpx" }
let(:context) { subject.context }
subject do
described_class.new(url: url)
end
let(:file) { File.open(File.join(Rails.root, "spec", "fixtures", "simple.gpx")) }
describe "#call" do
it "downloa... |
class CreateCriticReviews < ActiveRecord::Migration
def change
create_table :critic_reviews do |t|
t.references :movie, index: true, foreign_key: true
t.string :critic
t.date :date
t.string :original_score
t.string :freshness
t.text :quote
t.string :url
t.timestamp... |
class Converter
def convert_amount(amount,first_currency,second_currency)
begin
if first_currency == second_currency
return "#{amount} #{second_currency}"
end
rates = Endpoint.new.get_exchange_rates
if first_currency == 'CZK'
convert_from_czk(amount,rates,second_currency)
... |
class Book < ActiveRecord::Base
attr_accessible :price, :publish, :title, :avatar
has_attached_file :avatar, styles: {midium: "300x300#", thumb: "100x100#" },
path: "#{Rails.root}/public/system/:class/:id/:attachment/:style.:extension",
url: "/system/:class/:id/:attachment/:style.:extension"
validates_attac... |
class UsersController < ApplicationController
def new
@user = User.new
end
def create
@user = User.new(user_params)
if @user.save
flash[:success] = "Pomyślnie utworzono nowe konto"
Order.create(user: @user, status: "cart") #creates a shopping cart for a new user
redirect_to produc... |
SurveyBuilder::Engine.routes.draw do
resources :survey_forms do
get 'results', on: :member
resources :questions do
get 'new/:type', to: 'questions#new', as: 'new_typed' , on: :collection
end
resources :survey_responses
resources :responses
end
end
|
require "goon_model_gen"
module GoonModelGen
module Converter
class Mapping
attr_reader :name, :args, :func, :requires_context, :returns_error
attr_accessor :package_base_path, :package_name
attr_accessor :allow_zero # for int or uint only
def initialize(name, args, func, requires_context... |
# frozen_string_literal: true
module ObjectMatchers
def match_object(current_result, value)
return current_result if object.blank?
(value == object)
end
def match_array_of(current_result, value)
return current_result if object_array_type.blank? || !value.respond_to?(:all?)
value.all? { |it| it... |
require 'csv'
require 'pg'
if ENV["RACK_ENV"] == "production"
uri = URI.parse(ENV["DATABASE_URL"])
DB_CONFIG = {
host: uri.host,
port: uri.port,
dbname: uri.path.delete('/'),
user: uri.user,
password: uri.password
}
else
DB_CONFIG = { dbname: "restaurants" }
end
def db_connection
begin
... |
class LinkComponentPreview < ViewComponent::Preview
def default
render(LinkComponent.new(text: 'Here is an example link', path: '#'))
end
end
|
require 'spec_helper'
describe User do
describe 'validations' do
it { should have(1).error_on(:first_name) }
it { should have(1).error_on(:last_name) }
end
# describe 'is a member of team' do
# let(:user) { create(:user) }
# let(:team) { create(:team) }
# subject { user.is_a_member_of?(team) }
# ... |
class PolyTreeNode
attr_reader :parent, :children, :value
def initialize(value, parent = nil, children = [] )
@value = value
@parent = parent
@children = children
end
def parent=(parent_node)
@parent.children.delete(self) unless @parent.nil?
parent_node.nil? ? @parent = nil : @pare... |
require 'rubygems'
require 'Nokogiri'
require 'selenium-webdriver'
Encoding.default_external = Encoding.find('utf-8')
class Bilibili_Ranklist_Tag
@@count = 0 #count flag for Tag class
def initialize(b_string)
@@count += 1
@no = @@count #No of Tags
if /(【\d?\d月】)([^\d]*)(\d?\d)/ =~ b_string
@month ... |
# == Schema Information
#
# Table name: import_request_files
#
# id :integer not null, primary key
# file :string(255)
# created_at :datetime not null
# updated_at :datetime not null
#
class ImportRequestFile < ActiveRecord::Base
attr_accessible :file
mount_uploader :fil... |
class AddTutorialIdToFilter < ActiveRecord::Migration
def change
add_column :filters, :tutorial_id, :integer
end
end
|
# frozen_string_literal: true
require "tasks/scripts/telemedicine_reports_v2"
namespace :reports do
desc "Generates the telemedicine report"
task telemedicine: :environment do
period_start = (Date.today - 1.month).beginning_of_month
period_end = period_start.end_of_month
report = TelemedicineReportsV... |
module Asciidoctor
module Gb
class Converter < ISO::Converter
def standard_type(node)
type = node.attr("mandate") || "mandatory"
type = "standard" if type == "mandatory"
type = "recommendation" if type == "recommended"
type
end
def front(node, xml)
xml.b... |
namespace :setup do
desc "setup: copy config/master.key to shared/config"
task :copy_linked_master_key do
on roles(fetch(:setup_roles)) do
sudo :mkdir, "-pv", shared_path
upload! "config/master.key", "#{shared_path}/config/master.key"
sudo :chmod, "600", "#{shared_path}/config/master.key"
... |
require 'nokogiri'
require 'open-uri'
require 'pry'
class BillboardScraper
def initialize
doc = Nokogiri::HTML(open('https://www.billboard.com/charts/hot-100'))
scrape(doc)
end
def scrape(doc)
doc.css('.chart-data .chart-row').map do |entry|
song_info = {}
song_info[:chart_status] =... |
# frozen_string_literal: true
# rubocop:disable Metrics/MethodLength
# rubocop:disable Style/StringConcatenation
# rubocop:disable Naming/VariableNumber
require_relative 'test_helper'
require 'fileutils'
class TemplateFileOutputTest < Minitest::Test
def test_file_output_1
contents_fixture = File.read(File.join... |
# responsible for loading price-lists and comparing them
class PriceManager < Mapper::Base
attr_reader :dictionary
def initialize
super
end
#зчитуємо прайси з поточної директорії, якщо директорія не вказана
# в налаштуваннях, інакше зчитуємо прайси з поточної директорії
def get_price_names
FileUtils... |
class CourseForm < ActiveRecord::Base
belongs_to :course
has_many :class_activities
end
|
# encoding: UTF-8
# Copyright 2011-2013 innoQ Deutschland 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-2.0
#
# Unless required by appli... |
require './msg_base'
require './msg_types'
class MessageMessage < BaseMessage
def initialize(header: nil, flags: 1, kind: 0, sections: [])
@header = header
@flags = flags
@sections = sections
if @header != nil
@header.op_code = OP_MSG
end
end
def calculate_message_size
message_le... |
require_dependency "help/api/v1/application_controller"
module Help
class Api::V1::HelpOfferedsController < Api::V1::ApplicationController
before_action :authorize_for_controller
before_action :set_help_offered, only: [:show, :edit, :update, :destroy]
# GET /help_offereds
def index
render json: He... |
require 'spec_helper'
describe Ausgabe do
before do @ausgabe = Ausgabe.new(ausgabedatum: Date::current,
rueckgabedatum: Date::tomorrow,
kommentar: "tolle Karte, tun wir jetzt mal weg")
end
subject { @ausgabe }
it { should respond_to(:ausgabedatum) }
it { should respond_to(:rueckgabedat... |
Rails.application.routes.draw do
devise_for :users, controllers:{ omniauth_callbacks: "user/omniauth_callbacks" }
resources :articles
root to: "home#index"
get "todo", to: "articles#home_view"
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
end
|
require "uri"
module SwaggerClient
class JobsApi
basePath = "http://api2.online-convert.com/"
# apiInvoker = APIInvoker
# List of jobs active for the current user identified by the key.
# It will return the list of jobs for the given user. In order to get the jobs a key or token must be provided:\n ... |
FactoryGirl.define do
factory :sport do
name { FFaker::Sport.name }
end
end
|
# $Id$
module EternosBackup
# DataSchedules
#
# Could be db-driven but for now contains static min. time intervals for each kind
# of backup data set
module DataSchedules
# Minimum backup intervals times for each data set
MinDataBackupIntervals = {
EternosBackup::SiteData::General ... |
# frozen_string_literal: true
require 'spec_helper'
require_relative '../../lib/app.rb'
RSpec.describe Logs::Webserver do
subject { described_class.new(log_path) }
let(:log_path) do
File.join(File.expand_path('../fixtures', __dir__), 'webserver_3_lines.log')
end
let(:expected_lines_array) do
[
... |
require 'observer'
module Subject
def initialize
@observers=[]
end
def add_observer(observer)
@observers << observer
end
def delete_observer(observer)
@observers.delete(observer)
end
def notify_observers
@observers.each do |observer|
observer.update(self)
... |
class NotificationMailer < ApplicationMailer
default from: "golikealocal@gmail.com"
# Need to insert instance variables in mail template.
def notification_email(subscriptions)
@subscriptions = @subscriptions
mail(to: @subscriptions, subject: 'Your Pet has been located!')
end
end
|
# frozen_string_literal: true
require 'client/multipart_upload/chunks_client'
require_relative 'upload_client'
module Uploadcare
module Client
# Client for multipart uploads
#
# @see https://uploadcare.com/api-refs/upload-api/#tag/Upload
class MultipartUploaderClient < UploadClient
include Mul... |
class NameList
def showList(nameList)
nameList.map {|x| print "#{nameList.index(x)+1} - #{x}\n" }
end
def addName(nameList, name)
name.split.each{|x| if x =~/[0-9]/ then return puts "The name can not contain numbers" end }
nameList << name
puts "In the list of added a new name - #{name}. No... |
module CarrierWave
module BombShelter
VERSION = '0.2.1'.freeze
end
end
|
require 'bike'
describe Bike do
context "when first created" do
it 'has a broken method' do
expect(Bike.new).to respond_to(:broken)
end
it 'broken attr defaults to false' do
expect(Bike.new.broken).to eq(false)
end
end
end
|
class Upload < ActiveRecord::Base
attr_protected :id, :parent_id, :content_type, :filename, :thumbnail, :size, :width, :height, :user_id, :created_at, :updated_at
belongs_to :user
has_attachment :storage => :file_system, :partition => false, :path_prefix => 'public/files', :max_size => 100.megabytes
in... |
class CustomerTypesController < ApplicationController
before_action :set_customer_type, only: [:show, :update, :destroy]
# GET /customer_types
def index
@customer_types = CustomerType.all
render json: @customer_types
end
# GET /customer_types/1
def show
render json: @customer_type
end
# ... |
require 'rails_helper'
RSpec.describe Chef, type: :model do
describe "validations" do
it {should validate_presence_of :name}
end
describe "relationships" do
it {should have_many :dishes}
end
describe "Instance Methods" do
it "All Ingredients Method" do
bob = Chef.create!(name: "Bob")
... |
class Product < ActiveRecord::Base
belongs_to :company
has_and_belongs_to_many :branches
validates :description, presence: true
has_attached_file :picture, :styles => { :medium => '300x300>', :thumb => '100x100>' }, :default_url => "/images/:style/missing.png"
validates_attachment_presence :picture
end
|
class LikesController < ApplicationController
before_action :authenticate_user #ログインしていないユーザに対するアクセス制限
def index
@likes = Like.where(user_id: @current_user.id)
end
def like
@like = Like.new(user_id: @current_user.id, trainer_id: params[:trainer_id])
@like.save
redirect_to("/likes/index")
e... |
module Adminpanel
class PagesController < Adminpanel::ApplicationController
before_action :redefine_model
def show
end
def edit
params[:skip_breadcrumb] = true
super
end
def update
if @resource_instance.update(page_params)
redirect_to page_path(@resource_instance)
... |
module ApplicationHelper
def colored_tags(question_tags)
if question_tags.any?
content_tag(:small) do
"Tags: ".html_safe +
question_tags.map do |qt|
content_tag(:span, qt.name, style: "color: #{qt.color}")
end.join(', ').html_safe
end
end
end
end
|
class TrialFilterForm
EMPTY_FILTER_APPLIED_EVENT = "Empty Filter Applied".freeze
FILTER_APPLIED_EVENT = "Filter Applied".freeze
FILTER_WITH_VALUE_ALWAYS_SET = "distance_radius".freeze
NON_FILTER = "session_id".freeze
USER_WITHOUT_SESSION = "123456".freeze
ZIP_CODE_MATCH = /\A\d{5}(-\d{4})?\z/
include Act... |
FactoryGirl.define do
factory :article do
title "Of Mice And Men"
author "John Steinbeck"
end
end
|
class UpdateParametersTable < ActiveRecord::Migration
def change
drop_table :request_at_times
end
end
|
require 'cinch'
require 'yahoo_weatherman'
class Weather
include Cinch::Plugin
def initialize(bot)
super bot
@client = Weatherman::Client.new
end
match /weather (.+)/
def execute(m, location)
m.reply lookup location
end
private
def lookup(location)
response = @client.lookup_by_loca... |
FactoryGirl.define do
factory :client do
name { Faker::Company.name }
abbreviation { Faker::Lorem.characters(5) }
end
end
|
require 'ffi'
class Tuple < FFI::Struct
layout :x, :uint32,
:y, :uint32
def to_s
"(#{self[:x]},#{self[:y]})"
end
end
module Tuples
extend FFI::Library
ffi_lib 'target/debug/libtuples.dylib'
attach_function :flip_things_around, [Tuple.by_value], Tuple.by_value
end
tup = Tuple.new
tup[:x] = 1... |
class Asset < ApplicationRecord
has_many :asset_fields, dependent: :destroy
end
|
# Require gems
Bundler.require(:default, ENV['RACK_ENV'])
# Main entrypoint to require source files
def require_recursive(path)
files_list = Dir["#{File.dirname(__FILE__)}/#{path}/**/*.rb"].sort
files_list.each { |f| require f }
end
# Configuration files
require_recursive 'config'
# Application files
require_rec... |
# Copyright (c) 2006, 2007 Ruffdogs Software, Inc.
# Authors: Adam Lebsack <adam@holonyx.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License.
#
# This program ... |
require_relative "./element"
class Metacrunch::ULBD::Record::Beziehung < Metacrunch::ULBD::Record::Element
SUBFIELDS = {
p: { "Beziehungskennzeichnung" => :W },
n: { "Bemerkung" => :W },
a: {
"Titel" => :NW,
"Titel der in Beziehung stehenden Ressource" => :NW
},
"9": {
"Identifi... |
require 'open-uri'
require "net/http"
require 'rss'
namespace :rss do
desc "Daemon for fetching rss feeds"
task daemon: :environment do
begin
Feed.find_each(batch_size: 10) do |feed|
begin
data = open(feed.url)
fetched_feed = RSS::Parser.parse(data, false)
fetched_... |
class ApplicationController < ActionController::Base
before_action :authenticate_user!
protect_from_forgery with: :exception
before_action :configure_permitted_parameters, if: :devise_controller?
before_action :mark_notification_as_read
def mark_notification_as_read
if params[:notification_id]
notif ... |
require 'puppet/parameter/boolean'
Puppet::Type.newtype(:oneandone_loadbalancer) do
@doc = 'Type representing a 1&1 load balancer.'
ensurable
newparam(:name, namevar: true) do
desc 'The name of the load balancer.'
validate do |value|
raise('The name should be a String.') unless value.is_a?(String... |
class CreateContasReceber < ActiveRecord::Migration
def change
create_table :contas_receber do |t|
t.references :cliente
t.date :vencimento
t.float :valor
t.timestamps
end
add_index :contas_receber, :cliente_id
end
end
|
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe Api::V1::BillsController, type: :controller do
describe 'GET #index' do
context 'when there is no bill' do
before { get :index, format: :json }
it('returns http success') { expect(response).to have_http_status(:success) }
end
... |
class ChangeDataTypeForTimeSlot < ActiveRecord::Migration
def up
add_column :time_slots, :start_time_tmp, :datetime
add_column :time_slots, :end_time_tmp, :datetime
TimeSlot.reset_column_information
TimeSlot.all.each do |time_slot|
time_slot.start_time_tmp = DateTime.parse(time_slot.start_time.to_s... |
# frozen_string_literal: true
module Sam
module Unicorn
class Identifier
def initialize
@configurator = ::Unicorn::Configurator.new
end
def call(config_file)
@configurator.instance_eval configuration(config_file)
Integer(read_pidfile)
end
private
def... |
require 'rails_helper'
RSpec.describe SellCart, type: :model do
describe "about sellcart function" do
it "可以加入已存在的商品" do
p1 = Product.create(title: 'ball', quantity: 10)
sellcart = SellCart.new
sellcart.add_sellitem(p1.id)
expect(sellcart.empty?).to be false
end
it "加入的商品數量,都從一開... |
require 'spec_fast_helper'
require 'hydramata/works/value_presenter'
require 'hydramata/works/work'
require 'hydramata/works/predicate'
module Hydramata
module Works
describe ValuePresenter do
let(:work) { Work.new(work_type: 'a work type') }
let(:predicate) { Predicate.new(identity: 'a predicate') }... |
require "test_helper"
describe Work do
let(:work) { works(:one) }
let(:popular_work) { works(:two) }
let(:vote_one) { votes(:one) }
let(:vote_two) { votes(:two) }
let(:vote_three) { votes(:two) }
it "must be valid" do
expect(work.valid?).must_equal true
end
describe "validations" do
it "requi... |
require 'google/apis/calendar_v3'
require 'google/apis/oauth2_v2'
require 'google/api_client/client_secrets'
require 'json'
require 'sinatra'
require 'sinatra/base'
require 'logger'
require 'pry'
require 'pry-byebug'
require 'sequel'
require 'sqlite3'
require 'colorize'
require 'active_support/values/time_zone'
clas... |
require 'test_helper'
class FavoritesControllerTest < ActionController::TestCase
test "can get user favorites" do
get :index, format: :json, user_id: 'vikhyat', type: 'Anime'
assert_response :success
end
test "can add anime to favorites" do
sign_in users(:vikhyat)
assert_difference ->{ Favori... |
class CreateZonas < ActiveRecord::Migration[5.0]
def change
create_table :zonas do |t|
t.string :zona
t.st_polygon :area, geographic: true
t.boolean :lunes ,:default => false
t.boolean :martes ,:default => false
t.boolean :miercoles ,:default => false
t.boolean :jueves ,:de... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.