text stringlengths 10 2.61M |
|---|
class BookerManage
def self.save_feedback(booking_id, feedback)
begin
booking = Booking.find(booking_id.to_i)
booking.feedback = feedback
booking.save!
return {:success => true, :data => '儲存成功!'}
rescue => e
Rails.logger.error APP_CONFIG['error'] + "(#{e.message})" + ",From:app... |
#!/usr/bin/env ruby
require 'optparse'
require 'uri'
require 'open-uri'
require 'fileutils'
require './util.rb'
require './http'
$http = Crawler::NetHttp.new
def scan()
begin
options = {}
optparse = OptionParser.new do|opts|
# Set a banner, displayed at the top
# of the help screen.
opts.banner = "==... |
class Image < ActiveRecord::Base
self.table_name = 'Image'
has_many :post_images, foreign_key: 'Image_Id'
end
|
module Inventory
class QueryAvailableMetrcTags
prepend SimpleCommand
def initialize(facility_id, count, tag_type)
@facility_id = facility_id
@count = count
@tag_type = tag_type
end
def call
Inventory::MetrcTag.where(
facility_id: @facility_id,
status: Constant... |
require 'spec_helper'
describe "Database Pages" do
subject { page }
describe 'Add Property page' do
before { visit new_property_path }
it { should have_content('Add New Property')}
it { should have_title('Add New Property')}
end
end
|
# Preview all emails at http://localhost:3000/rails/mailers/employee_mailer
class EmployeeMailerPreview < ActionMailer::Preview
def welcome_preview
@employee = Employee.first.id
EmployeeMailer.welcome(@employee)
end
end
|
class RenameGoalsPublicColumn < ActiveRecord::Migration
def change
remove_column :goals, :public, :boolean
add_column :goals, :publicized, :boolean
end
end
|
# coding: utf-8
namespace :garbage_collector do
desc 'Очистка мусорных картинок'
task :images => :environment do
Apress::Images::GarbageCollectorService.new.call
end
end
|
require File.dirname(__FILE__) + '/../../spec_helper'
describe "/institucions/show.html.erb" do
include InstitucionsHelper
before(:each) do
@institucion = mock_model(Institucion)
@institucion.stub!(:institucion).and_return("MyString")
@institucion.stub!(:sigla).and_return("MyString")
@institucio... |
class AddAswerToIntent < ActiveRecord::Migration[5.0]
def change
add_reference :intents, :answer, foreign_key: true
end
end
|
FactoryGirl.define do
factory :user, aliases: [:assignee] do
email { Faker::Internet.email }
sequence(:name) { |n| "#{Faker::Internet.user_name}#{n}" }
password "12345678"
password_confirmation { password }
trait :admin do
admin true
end
factory :admin, traits: [:admin]
end
f... |
class Api::TasksController < ApplicationController
def index
render json: Task.all
end
end
|
class AddCaseIdToContents < ActiveRecord::Migration
def change
add_column :contents, :case_id, :integer
add_index :contents, :stepnumber
end
end
|
class InvoicePolicy < ApplicationPolicy
def permitted_attributes
[
:price,
:invoice_reference,
:invoicing_informations,
:invoicing_paypal_address,
:company_id,
:vat_number,
:additional_informations,
:due_date,
:quotation_id,
:currency_uid
]
end
... |
class Recipe < ActiveRecord::Base
####################
### Associations ###
####################
has_many :authorships
has_many :brewers, :through => :authorships
accepts_nested_attributes_for :authorships
end
|
require_relative 'spec_tiller/sync_test_suite'
require_relative 'spec_tiller/matrix_parser'
require 'pry'
spec_dir_glob = 'spec/**/*_spec.rb'
specs_in_dir = Dir.glob(spec_dir_glob).map { |file_path| file_path.slice(/(spec\/\S+$)/) }
filepath = 'spec/documents/.travis.yml'
travis_yaml = TravisYaml.new(filepath: filep... |
# 08.01.2020
# Unit 3 Exercise 3
# Write a program that allows a user to enter the number of petals on a flower.
# Then one by one, print “plucking petal #1: they love me!”. Alternate
# “They love me” and “They love me not” as well as increase the petal
# number for each petal.
puts "Please enter the number of pet... |
# frozen_string_literal: true
require 'rails_helper'
describe 'フロント画面:カテゴリ作成', type: :system do
context 'ログインしているとき' do
before do
sign_in_as(login_user)
visit new_company_category_path(login_user.company)
end
context '権限が not_grader のとき' do
let(:login_user) { FactoryBot.create(:user, ... |
class PendingEmailJob < ApplicationJob
queue_as :default
def perform(customer, host, reservation_id)
# Do something late
UserMailer.reservation_email(customer, host,reservation_id).deliver_now
end
end
|
require 'frequency'
class StringFollower
def initialize
@string_table = {}
@prefix = []
end
def eat_dir(dir)
end
def feed(str, ch = nil)
feed_item(str, ch) if ch
feed_string(str) unless ch
end
def most_likely(str)
freq = @string_table[str]
if (freq)
freq.highest_freq... |
#!/usr/bin/ruby -w
puts "Hello, Ruby!" # So this is the main output from the program (and an inline comment)
# This is run before the main program (btw. this is a comment)
BEGIN {
puts "Initializing program..."
}
=begin
So this is what block comments look
like in Ruby. Pretty ugly,
if you ask me.
=end
# This r... |
xml.rss('version' => '2.0', 'xmlns:dc' => "http://purl.org/dc/elements/1.1/", 'xmlns:atom' => "http://www.w3.org/2005/Atom") do
xml.channel do
xml.title @feed[:title]
xml.link "http://audiovision.scpr.org"
xml.atom :link, href: @feed[:href], rel: "self", type: "application/rss+xml"
xml.de... |
require 'spec_helper'
RSpec.describe PipelineRequest do
it 'Easily serializes to a JSON hash' do
dummy_request = {
foo: true,
bar: 'string'
}
request = PipelineRequest.new dummy_request
expect(request.to_json).to eq(dummy_request.to_json)
expect(request.to_h).to eq(dummy_request)
... |
# frozen_string_literal: true
module Api::V1
class PaymentSourcePolicy < ApplicationPolicy
def destroy?
record.user_id == user.id
end
alias make_default? destroy?
end
end
|
class AlterColumnClientInn < ActiveRecord::Migration
def change
change_column :clients, :inn, :integer, :limit => 8
end
end |
class ComputerPlayer < Player
attr_reader :color, :name, :board
def initialize(board, display, color, name)
@board = board
@display = display
@color = color
@name = name
end
def move(selected_pos)
if selected_pos
position = board[selected_pos].valid_moves.sample
else
pieces... |
# 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], # First col
[1,4,7], # Middle col
[2,5,8], # Last col
[0,4,8], # L->R di... |
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'directors_database'
require 'pry'
# Find a way to accumulate the :worldwide_grosses and return that Integer
# using director_data as input
def gross_for_director(director_data)
movie_index = 0
director_total = 0
while movie_index < director_data[:movies].lengt... |
# -*- mode: ruby -*-
servers = [
{
:name => "k8s-master",
:type => "master",
:box => "ubuntu/xenial64",
:ip => "192.168.50.10",
:mem => "2048",
:cpu => "2"
},
{
:name => "k8s-node1",
:type => "node",
:box => "ubuntu/xenial64",
:... |
module Kaya
module View
class Sections
@@sections = {
"Test Suites" => "suites/suites",
"Features" => "features/features",
"Feature" => "features/feature",
"Results"=> "results/results",
"Console" => "results/console",
"Report" => "results/report",
"... |
require_relative 'core_ext/attr_history'
require_relative 'pac_man'
class Player
extend AttrHistory
attr_reader :uid
attr_historized(:score)
def initialize(uid)
@uid = uid
@pacmans = {}
end
def get_pac_man(uid); @pacmans[uid] ||= PacMan.new(self, uid); end
def raw_pacmans; @pacmans.values; end... |
require 'spec_helper'
module Frank::HTTP
describe MediaRange do
describe "#to_s" do
context "when no attributes given" do
it "gets header value" do
header = MediaRange.new('text/html')
header.to_s.should eq('text/html')
end
end
context "when one attribute gi... |
class CollaboratorsController < ApplicationController
before_filter :signed_in_user
before_filter :correct_user, only: [:edit, :update]
before_filter :admin_user, only: [:index, :destroy, :create, :new]
def index
@collaborators = Collaborator.paginate(page: params[:page])
end
def show
@colla... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.box_check_update = false
config.vbguest.auto_update = false
config.vbguest.auto_reboot = false
config.vm.define "Web" do |web|
web.vm.network "private_network", ip: "192.168.33.10"
... |
class Operator < ActiveRecord::Base
has_and_belongs_to_many :routes
end
|
class BirdsController < ApplicationController
def index
birds = Bird.all
# render json: birds
# render json: birds, only: [:id, :name, :species]
# rails has the only syntax that works with nested information
# render json: birds, except: [:created_at, :updated_at]
# or just exclue the fields... |
class CreateLessons < ActiveRecord::Migration[6.0]
def change
create_table :lessons do |t|
t.references :course_schedule, null: false, foreign_key: true
t.references :course_period, null: false, foreign_key: true
t.date :date
t.integer :week
t.boolean :complete
t.boolean :holid... |
Rails.application.routes.draw do
namespace :api, defaults: {format: 'json'} do
namespace :v1 do
resources :testcases
resources :steps
resources :testsets
resources :actions
resources :locator_types
end
end
# For details on the DSL available within this file, see htt... |
Rails.application.routes.draw do
root to: 'transactions#new'
resources :transactions, only: [:new, :create, :index]
end
|
class AddUrlNameToMemories < ActiveRecord::Migration[5.1]
def change
add_column :memories, :name, :string
add_column :memories, :url, :string
end
end
|
# Path to root of plugin dir
plugin_root = File.join(File.dirname(__FILE__), '../../../')
$:.unshift(plugin_root + 'lib')
# Use vendor rails if possible
if File.directory?(rails_dir = File.join(plugin_root, '../../rails'))
$:.unshift File.join(rails_dir, 'activerecord/lib')
$:.unshift File.join(rails_dir, 'actionp... |
# frozen_string_literal: true
require 'statistic_calcs/chi_square_contrast/goodness_and_fit'
require 'statistic_calcs/distributions/gumbel_maximum'
require 'statistic_calcs/helpers/math'
module StatisticCalcs
module ChiSquareContrast
class GumbelMaximumGoodnessAndFit < GoodnessAndFit
def init!
sup... |
=begin
Report.for(:category_by_month).run(2018)
===================================
Summary By Category By Month (2018)
===================================
Category January February March April
Accomodation X.XX X.XX ... |
# frozen_string_literal: true
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name:... |
require 'bundler/setup'
require './campaign'
require './factory'
require 'securerandom'
ENV['RACK_ENV'] ||= 'development'
Bundler.require :default, ENV['RACK_ENV'].to_sym
class MadvidiApp < Sinatra::Base
register Sinatra::Initializers
# this uses cookies so is it fine with http://en.wikipedia.org/wiki/... |
# encoding: utf-8
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
unless defined?(SPEC_ROOT)
SPEC_ROOT = File.join(File.dirname(__FILE__))
end
require 'activerecord_diy'
ActiveRecord::Base.establish_connection({
"adapter" => "mysql2",
"encoding" => "utf8",
"reconnect" => false,
"database" => "act... |
# frozen_string_literal: true
require 'jiji/test/test_configuration'
require 'jiji/test/data_builder'
describe Jiji::Model::Trading::Process do
include_context 'use data_builder'
let(:broker) { Jiji::Test::Mock::MockBroker.new }
let(:context) { data_builder.new_trading_context(broker) }
context 'thread poolを... |
class DepositorsController < ApplicationController
before_action :authenticate_user!
before_action :restrict_to_admin, only: [:new, :create, :edit, :update, :destroy,
:edit_permissions, :remove_permission, :add_permission]
before_action :set_depositor, only: [:show, :edi... |
# frozen_string_literal: true
ActiveAdmin.register TimeFrameGroup do
decorate_with TimeFrameGroupDecorator
menu parent: 'Corsi'
filter :group_date
filter :ends_at
permit_params do
[:label, :enabled].tap do |params_to_permit|
params_to_permit << :group_date if params[:action].in?(%w(new create))
... |
require 'spec_helper'
describe Event, '.in_progress?' do
let(:user) { create(:user, :paul) }
context 'when the event has not yet started' do
let(:event) do
create(:event, :tasafoconf, owner: user, start_date: Date.today + 2,
end_date: Date.today + 2)
end
it 'ret... |
# frozen_string_literal: true
# user controller for new, create, account activation, and dashboard
class UsersController < ApplicationController
def show
render locals: {
facade: UserDashboardFacade.new(current_user)
}
# TODO: update with Oauth token
end
def new
@user = User.new
end
d... |
class Category < ActiveRecord::Base
belongs_to :user
has_many :categories_expenses, :dependent => :destroy
has_many :expenses, :through => :categories_expenses
validates_presence_of :name
end
|
module FactoryGirl
class AttributeList
include Enumerable
def initialize
@attributes = []
end
def define_attribute(attribute)
if attribute_defined?(attribute.name)
raise AttributeDefinitionError, "Attribute already defined: #{attribute.name}"
end
@attributes << attri... |
class ClientsController < ApplicationController
before_filter :get_account
before_filter :inner_navigation
before_filter :restrict_access
before_filter :restrict_account_access, :except => [:index, :new, :create]
def index
@clients = @account.clients.find(:all, :conditions => {:is_account_master => false... |
require "spec_helper"
RSpec.describe TwitterBro::BearerToken do
let(:value) { "text" }
let(:token) do
described_class.new value: value
end
subject { token }
its(:value) { is_expected.to eq value }
describe "#to_s" do
subject { token.to_s }
it { is_expected.to eq value }
end
end
|
class Setting < ActiveRecord::Base
belongs_to :user
belongs_to :page
belongs_to :font
mount_uploader :image, ImageUploader
after_save :update_dimensions
after_save :update_public_id
before_destroy :destroy_cloudinary_image
attr_accessor :sync
attr_accessor :color_str
attr_accessor :crop_x, :crop_y, :crop_... |
class ScriptBeatSerializer < ActiveModel::Serializer
attributes :id,
:start_line,
:beat_type,
:content,
:start_time,
:end_time,
:episode_id
# has_one :episode, embedded: true
has_many :characters, embedded: true
end
|
class Food < ApplicationRecord
has_many :food_order_items
has_many :orders, through: :food_order_items
end
|
class Artwork < ActiveRecord::Base
belongs_to :card
validates_presence_of :image_path
def transform
image = Magick::Image.read(image_path).first
image.contrast_stretch_channel(Magick::QuantumRange * 0.09).modulate(1.0, 1.1, 1.0).gaussian_blur(0.0, 0.5).write("tmp/transformed_#{image_name}")
end
end |
class User < ActiveRecord::Base
has_secure_password
validates_uniqueness_of :name
has_many :jobs
end
|
class Country < ApplicationRecord
has_and_belongs_to_many :groups
has_many :cities
before_create do
self.name = name.downcase
end
validates :name, uniqueness: true
end
|
Facter.add('nessus_cli') do
confine :kernel => 'Linux'
setcode do
result = false
if File.exists? '/opt/nessus/bin/nessuscli'
result = true
elsif File.exists? '/opt/nessus/sbin/nessuscli'
result = true
end
result
end
end
|
require 'data_mapper' unless defined?DataMapper
require 'ysd_md_yito' unless defined?Yito::Model::Finder
require 'ysd_md_calendar' unless defined?Yito::Model::Calendar::Calendar
require 'ysd_md_rates' unless defined?Yito::Model::Rates::PriceDefinition
require 'aspects/ysd-plugins_applicable_model_aspect' unless defined... |
require_relative 'game'
describe "Game of Life" do
before :all do
@body = Body.new
end
context "Body" do
subject { Body.new(5,6)}
it "will be an instance of Body" do
expect(subject).to be_a(Body)
end
it "will have these methods" do
expect(subject).to respond_to(:rows)
expect(subject).to re... |
require "spec_helper"
describe WasabiV3::Resolver do
describe "#resolve" do
it "resolves remote documents" do
expect(HTTPI2).to receive(:get) { HTTPI2::Response.new(200, {}, "wsdl") }
xml = WasabiV3::Resolver.new("http://example.com?wsdl").resolve
expect(xml).to eq("wsdl")
end
it "res... |
module Common
#类方法
module ClassMethods
def boolean_options
{true => common_label("true"), false => common_label("false")}
end
def common_label(label)
I18n.translate label, default: [label.to_s]
end
end
#类方法 end
#------------------------------------------------------------------... |
class ApplicationController < ActionController::Base
protect_from_forgery
# before_filter :authenticate_user!
rescue_from CanCan::AccessDenied do |exception|
redirect_to root_url, :alert => exception.message
end
# redirect to a specific page on successful sign in
def after_sign_in_path_for(resourc... |
require 'spec_helper'
describe "Creating a new Blog" do
context "when a user is signed in" do
before :each do
user = create(:user)
login_as(user, scope: :user)
visit new_blog_path
end
context "when the user inputs valid data" do
before :each do
fill_in :blog_title, with: 'My First Blog'
fil... |
#!/usr/bin/env ruby
require 'directory_watcher'
dw = DirectoryWatcher.new '.'
dw.interval = 1.0
dw.glob = 'script/**/*.coffee'
dw.reset true
dw.add_observer do |*args|
args.each do |event|
puts "#{Time.now.strftime("%I:%M:%S")} #{event.path} #{event.type}"
puts `cake.coffeescript build:coffee`
end
end
dw... |
class DocumentsController < AuthenticatedController
def index
@documents = Document.order(id: :asc).page(params[:page] || 1)
end
end
|
#!/usr/bin/env ruby
#
# check-temp-sensor.rb
#
# DESCRIPTION:
# Checks temperature provided by sensor attached to Raspberry Pi
#
# OUTPUT:
# plain text
#
# PLATFORMS:
# Linux
#
# DEPENDENCIES:
# gem: sensu-plugin
# gem: rpi_gpio
#
# USAGE:
# check-temp-sensor.rb -F -w 50 -c 70
#
# NOTES:... |
class AddIsSendedToEventNameSticks < ActiveRecord::Migration
def self.up
add_column :event_name_sticks, :is_sended, :integer, :default=>0
end
def self.down
remove_column :event_name_sticks, :is_sended
end
end
|
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_action :current_user
before_action :require_login
before_action :count_of_items_in_order
before_action :count_of_new_items
private
def current_user
@current_user ||= Merchant.find_by(id: session[:user_i... |
require 'lib/debug_mode.rb'
require 'lib/extra_keys.rb'
ZOOM_FACTOR = 2
MAX_SPEED = 80
STEER_STRENGTH = 80
WANDER_STRENGTH = 0.1
CELL_SIZE = 40
VIEW_RADIUS = 100
DT = 1 / 60
def outside_screen?(position)
position.x.negative? || position.x >= 1280 || position.y.negative? || position.y >= 720
end
def vector_length... |
class Person
attr_accessor :name
@@all = []
def initialize(name)
@name = name
@@all << self
end
def self.all
@@all
end
def person_hobbies
PersonHobby.all.select do |pair|
pair.person == self
end
end
#Find which hobbies a certa... |
require 'digest/md5'
require 'feed2email/entry'
require 'feed2email/feed'
require 'feed2email/migrate/migration'
module Feed2Email
module Migrate
class HistoryImportMigration < Migration
def apply
applicable? && migrate
end
private
def applicable?
table_empty?
end
... |
require './producer.rb'
require './instancecounter.rb'
class Train
include Producer
include InstanceCounter
attr_reader :number, :type
@@trains = {}
NUMBER_FORMAT = /[а-я0-9]{3}\-?[а-я0-9]{2}\z/i
def self.find(number)
@@trains[number]
end
def initialize(number, producer_name, type)
@speed =... |
class CreateChefProfiles < ActiveRecord::Migration
def change
create_table :chef_profiles do |t|
t.integer :cheff_id
t.text :about_me
# Typical Day
t.text :why_i_love_cooking
t.text :people_places_that_inspire_my_food
t.text :best_compliment
t.text :why_do_i_want_to_join_... |
class ProjectManagement
class << self
include PathConfig
# 操作工程的 启动,关闭,重启,usr
# param operation 要做的操作
# start stop restart usr2_stop
def operate(project_name,operation)
check_project_name(project_name)
unicorn_sh = File.join(UNICORN_SH_PATH,"unicorn.sh")
raise "不支持 #{op... |
# frozen_string_literal: true
require 'bolt_setup_helper'
test_name "Set root/Administrator password to a known value" do
extend Beaker::HostPrebuiltSteps
extend Acceptance::BoltSetupHelper
hosts.each do |host|
case host['platform']
when /windows/
on host, "passwd #{winrm_user}", stdin: winrm_pas... |
class AddImgUpdatedAtToImages < ActiveRecord::Migration
def change
if Rails.env.real_production?
say <<-TEXT
################################################################
# bundle exec rake images_table:rename_updated_at #
#############################################... |
class Api::V1::ApplicationController < ActionController::API
before_action :authenticate_api_user
def authenticate_api_user
@current_api_user
begin
if request.headers["HTTP_AUTHORIZATION"].present?
token = request.headers["HTTP_AUTHORIZATION"]
decoded_token = JWT.decode token, hmac_s... |
class Broker < ApplicationRecord
belongs_to :brokerage
has_many :reviews
end
|
require 'test_helper'
class Publish::ProductsControllerTest < ActionController::TestCase
include Devise::TestHelpers
def setup
@foreigner = publishers(:john)
@publisher = publishers(:jane)
@publisher.confirm!
sign_in @publisher
@catalog = catalogs(:janes)
@product = products(:janes)
end... |
class Api::UsersController < ActionController::Base
before_action :doorkeeper_authorize!
def index
render json: { data: User.all }
end
end
|
describe ProposalDecorator do
describe "#detailed_status" do
context "pending" do
it "returns 'pending [next step type]'" do
proposal = create(:proposal, status: "pending")
create(:approval_step, status: "actionable", proposal: proposal)
decorator = ProposalDecorator.new(proposal)
... |
RSpec.describe GetAddress do
extend SetupConfiguration
shared_examples 'configuration' do
it 'should return the get_address configuration' do
expect(config.api_key).to eq 'MY_API_KEY'
expect(config.format_array).to be true
expect(config.sort).to be false
end
end
it 'has a version num... |
require "erubis"
module Rulers
class Controller
def initialize(env)
@env = env
end
def env
@env
end
def render(view_name, locals = {})
file_name = File.join "app", "views", controller_name, "#{view_name}.html.erb"
tempate... |
module Apress
module Images
module Extensions
# Public: отложенная обработка изображений
module BackgroundProcessing
extend ActiveSupport::Concern
# Public: путь к заглушке
DEFAULT_PROCESSING_IMAGE_PATH = '/images/stubs/stub_:style.gif'
included do
# Public: ... |
require "rails_helper"
RSpec.describe Api::V1::DemographicsController, type: :controller do
let!(:first_user) {User.create!(id: 1, first_name: "John", last_name: "Smith", username: "johnsmith", email: "johnsmith@smith.com", password: "1234567" )}
let!(:first_restaurant) { Restaurant.create!(id: 1, name: "Panera", ... |
FactoryGirl.define do
factory :homework do
sequence(:title) {|n| "test homework#{n}"}
content 'ipsum lorem....'
creator
course
deadline 4.days.from_now
trait :expired do
deadline 4.days.ago
end
end
end
|
require 'rails_helper'
RSpec.describe OrderAddress, type: :model do
describe '購入情報の保存' do
before do
@order_address = FactoryBot.build(:order_address)
end
context '購入情報を保存するとき' do
it '必要な情報を適切に入力されている場合' do
expect(@order_address).to be_valid
end
it '建物名が空の場合' do
@o... |
module RedmineGitHosting
module Hooks
class GitProjectShowHook < Redmine::Hook::ViewListener
render_on :view_projects_show_left, :partial => 'git_urls'
end
end
end
|
class CreatePostTable < ActiveRecord::Migration
def change
create_table :posts do |t|
t.string :name
t.string :subject
t.text :body
t.datetime :date_time
t.integer :user_id
end
end
end
|
require 'spec_helper'
describe SessionsController do
describe "GET new" do
it "renders the new template for unauthenticated user" do
get :new
expect(response).to render_template :new
end
it "redirects to home path for authenticated user" do
session[:user_id] = Fabricate(:user).id
... |
require "jotform/api_method"
require "jotform/user"
require "net/http"
require "uri"
require "json"
module JotForm
class API
ENDPOINT = "http://api.jotform.com"
VERSION = "v1"
# @return [String]
attr_reader :api_key
# @return [Integer]
attr_reader :limit_left
# @param [String] api_key... |
require "rails_helper"
describe Contact do
describe 'validations' do
it { should validate_presence_of :email }
it { should validate_presence_of :message }
end
end
|
require 'rubygems'
require 'jira-ruby'
host = ENV['JIRA_HOST']
username = ENV['JIRA_USERNAME']
password = ENV['JIRA_PASSWORD']
project_query = ENV['JIRA_BOARD_QUERY']
options = {
username: username,
password: password,
context_path: '',
site: host,
auth_type: :basic,
read_timeout: 120
}
STATUS = {
back... |
require File.expand_path('../Product/exempt_product', __FILE__)
require File.expand_path('../Product/taxed_product', __FILE__)
require File.expand_path('../Product/imported_exempt_product', __FILE__)
require File.expand_path('../Product/imported_taxed_product', __FILE__)
class Basket
def initialize()
@product_l... |
require_relative '../spec_helper'
describe ReplaceNamedReferences do
it "should replace named references with the references that they point to" do
input = <<END
A1\t[:named_reference, "Global"]
A2\t[:named_reference, "Local"]
A3\t[:sheet_reference,"otherSheet",[:named_reference, "Local"]]
A4\t[:sheet_reference,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.