text stringlengths 10 2.61M |
|---|
# frozen_string_literal: true
Sequel.migration do
change do
create_table(:novels) do
Integer :id, identity: true, primary_key: true
column :created, 'timestamp with time zone', null: false, default: Sequel.lit('CURRENT_TIMESTAMP')
column :updated, 'timestamp with time zone', null: false, defaul... |
class GupeaAdapter
attr_accessor :id, :title, :alt_title, :abstract, :keywords, :pubyear, :language, :isbn, :author, :disslocation, :dissdate, :sourcetitle, :artwork_type, :links, :handle_suffix, :xml
include ActiveModel::Serialization
include ActiveModel::Validations
def initialize hash
@handle_suffi... |
require File.dirname(__FILE__) + '/../../spec_helper'
require 'set'
describe "Set#divide" do
it "divides self into a set of subsets based on the blocks return values" do
set = Set["one", "two", "three", "four", "five"].divide { |x| x.length }
set.should == Set[Set["one", "two"], Set["four", "five"], Set["thr... |
class Customer::OrdersController<ApplicationController
before_action :authenticate_user!
before_action :authorize_customer
before_action :get_cart, only: [:new]
Stripe.api_key = "sk_test_51JAxb5SCyiDBRZbt4lKJl31cRILleGhNNcIXQ3vXqPzh4LBhNsZ8NV5f1PFnkrWrNoxA3fIenUHkN5v7AWqMyhCf00pJkH9YEK"
def index
@or... |
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
helper_method :current_user
protected
def current_user
if session[:email]
if tenant = Tenant.find_by(email: session[:email])
tenant
elsif manager = PropertyManager.find_by(email: session[:email])
m... |
module Mutant
class Runner
# Abstract base class for computation sinks
class Sink
include AbstractType
# sink status
#
# @return [Object]
#
# @api private
abstract_method :status
# Test if computation should be stopped
#
# @return [Boolean]
#... |
#!/usr/bin/ruby
# Encoding: utf-8
#
# Copyright 2020 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
require "rails_helper"
describe Board do
it "has proper attributes" do
board = build(:board, name: "Travel", slug: "travel")
expect(board).to be_valid
end
it "can't be created with wrong attributes" do
board = build(:board, name: nil, slug: nil)
expect(board).to be_invalid
expect(board.err... |
require 'mendeley'
require 'wikipedia'
require 'data_mapper'
require 'dm-core'
require 'vocabularise/model'
require 'vocabularise/cache'
require 'vocabularise/hit_counter'
require 'vocabularise/wikipedia_ext'
require 'vocabularise/mendeley_ext'
module ... |
class Dav1d < Formula
desc "AV1 decoder targeted to be small and fast"
homepage "https://code.videolan.org/videolan/dav1d"
url "https://code.videolan.org/videolan/dav1d/-/archive/0.9.2/dav1d-0.9.2.tar.bz2"
sha256 "0d198c4fe63fe7f0395b1b17de75b21c8c4508cd3204996229355759efa30ef8"
license "BSD-2-Clause"
head ... |
# :nodoc:
module Geopolitical
VERSION = '3.0.0'.freeze
end
|
class FollowSerializer < ActiveModel::Serializer
attributes :id, :leader_id, :follower_id
has_many :leaders, each_serializer: LeaderSerializer
end
|
require 'test_helper'
class DeductionDetailsControllerTest < ActionDispatch::IntegrationTest
setup do
@deduction_detail = deduction_details(:one)
end
test "should get index" do
get deduction_details_url
assert_response :success
end
test "should get new" do
get new_deduction_detail_url
a... |
class Station < ApplicationRecord
has_one :address, as: :addressable, dependent: :destroy
has_many :edges, dependent: :destroy
validates :provided_id, presence: true
end
|
class Order < ApplicationRecord
belongs_to :customer
belongs_to :restaurant
has_many :ordered_foods, dependent: :destroy
has_many :foods, through: :ordered_foods
def increment
if self.id == Order.last.id
next_id = Order.first.id
else
next_id = self.id + 1
... |
# frozen_string_literal: true
##
# Class copied from Hyrax at 2f8e8534d95ac7.
#
# Converts UploadedFiles into FileSets and attaches them to works.
class AttachFilesToWorkJob < Hyrax::ApplicationJob
queue_as Hyrax.config.ingest_queue_name
# @param [ActiveFedora::Base] work - the work object
# @param [Array<Hyrax... |
class Flight < ApplicationRecord
has_and_belongs_to_many :users
has_one :departure_airport
has_one :arrival_airport
end
|
class FixPublicationInfoColumnName < ActiveRecord::Migration
def change
rename_column :publication_infos, :type, :pub_type
end
end
|
require 'ffi'
require 'rbconfig'
require 'thread'
module Typhoeus
module Curl
# this does not implement the full curl lib. just what is needed for typhoeus
def Curl.windows?
!(RbConfig::CONFIG['host_os'] !~ /mingw|mswin|bccwin/)
end
extend ::FFI::Library
VERSION_NOW = 3
GLOBAL_SSL ... |
module SettingsHelper
def text_configuration_field(config)
text_field_tag(
config.name,
config.value,
{ 'data-tooltip' => t(config.description)}
)
end
def configuration_field(config)
method = config.configuration_type.helper_method
send(method.to_sym, config)
end
end
|
class AddResetPwdTokenToUsers < ActiveRecord::Migration
def change
add_column :users, :reset_pwd_token, :string
add_column :users, :reset_pwd_state, :boolean, :default =>0
end
end
|
# 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 bin/rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# ... |
class Mvp
class PuppetfileParser
def initialize(options = {})
@sources = {}
@modules = []
@repo = nil
end
def suitable?
defined?(RubyVM::AbstractSyntaxTree)
end
def sources=(modules)
modules.each do |row|
next unless row[:source]
next if row[:sour... |
class CreateTrnProdPlanHeaders < ActiveRecord::Migration[6.0]
def change
create_table :trn_prod_plan_headers do |t|
t.string :plant, :limit => 4, :null => false
t.string :plan_order_no,:limit=>30
t.string :work_center, :limit => 10, :null => false
t.string :sfg_code, :limit => 40, :null => false
t.... |
class BooksController < ApplicationController
before_action :set_book, only: [:show, :edit, :update, :destroy]
before_action :check_user_id
def check
@book = Book.find(params[:book_id])
if @book.user_id == nil
@book.update(user_id:current_user.id)
redirect_to :back
else
@book.update... |
module Fog
module Compute
class Brkt
class Real
def create_server_template(workload_template_id, attributes={})
request(
:expects => [201],
:method => "POST",
:path => "v1/api/config/workloadtemplate/#{workload_template_id}/instancetemplates",
... |
class User < ActiveRecord::Base
has_many :products
validates: email
presence: true,
uniqueness: true
end
|
require 'spec_helper'
describe Client do
let(:user) { FactoryGirl.create(:user) }
before do
@client = FactoryGirl.create(:client, user_id: user)
end
subject { @client }
it { should respond_to(:user_id) }
it { should respond_to(:name) }
it { should respond_to(:ticker_symbol) }
it { should respond... |
module MDML
class Expression
LITERALS = {
'true' => true,
'false' => false,
'nil' => nil,
'null' => nil
}
def self.parse(markup)
new.parse(markup)
end
def parse(markup)
if LITERALS.key?(markup)
LITERALS[markup]
elsif match = marku... |
require File.dirname(__FILE__) + '/../../spec_helper'
describe "/ministerios/index.html.erb" do
include MinisteriosHelper
before(:each) do
ministerio_98 = mock_model(Ministerio)
ministerio_98.should_receive(:ministerio).and_return("MyString")
ministerio_98.should_receive(:responsable).and_return("My... |
module Fog
module Compute
class Brkt
class Real
def list_load_balancer_listeners(lb_id)
request(
:expects => [200],
:path => "v1/api/config/loadbalancer/#{lb_id}/listeners"
)
end
end
class Mock
def list_load_balancer_listene... |
class Session < ActiveRecord::Base
BARRIERS1 = ['1.1 Needle Anxiety', '1.2 Pain', '1.3 Able to do prep', '1.4 Inject in right place', '1.5 Safety Concerns', '1.6 Social and Aestheic Concerns', '1.7 Convenience', '1.8 Self Sufficiency' ]
BARRIERS2 = ['2.1 Needle Anxiety', '2.2 Pain', '2.3 Able to do prep', '2.4 In... |
# Copyright 2014 Square Inc.
#
# 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 applicable law or agreed ... |
class StationForm < WellFormed::Form
model :station, attributes: [:name]
model :address, attributes: [:street, :city, :state, :zip], parent: :station
model :coordinate_pair, parent: :station
validate do
unless address.present? ^ coordinate_pair.present?
errors.add(:base, <<~TEXT)
One and only... |
class EntitiesController < ApplicationController
skip_before_action :verify_authenticity_token, only: [:update_positions]
before_action :set_owner
before_action :set_agent
before_action :check_user_rights
before_action :set_entities_list
before_action :set_entity, except: [:create, :update_positions, :new_i... |
Rails.application.routes.draw do
resources :products do
resources :reviews
end
root :to => 'reviews#index'
end
|
# == Schema Information
#
# Table name: editorial
#
# id :integer not null, primary key
# name :string(255) not null
#
class Editorial < ActiveRecord::Base
# Associations
has_many :books
end
|
# frozen_string_literal: true
class MemberApplication < ApplicationRecord
payable
has_many :member_applicants
accepts_nested_attributes_for :member_applicants
has_one :approver, class_name: 'User'
validates :member_applicants, presence: true
scope :pending, -> { where(approved_at: nil).includes(:member_... |
class Thaum < Formula
homepage "https://flaque.github.io/thaum/"
desc "A boilerplate and scaffolding command line utility."
version "0.6.0"
if MacOS.prefer_64_bit?
url "https://github.com/Flaque/thaum/releases/download/v0.6.0/thaum-macos-amd64.zip"
sha256 "53c81f36e71fcaa0cc3f0e835068141788d67c6e24ec5f... |
class Retail::CatalogsController < RetailController
actions :index, :show
respond_to :html, :xml, :rss
def index
index! do |format|
format.html do
@products = Product.available.for_retail.first(5)
end
format.xml do
render :xml => @catalogs.to_xml(:except => [:private, :passw... |
require 'rails_helper'
RSpec.describe "flight show page" do
before :each do
@southwest = Airline.create(name: "Southwest Airlines")
@american = Airline.create(name: "American Airlines")
@southwest_1 = @southwest.flights.create(number: "SW1", date: "10/10/20", time: "1300", departure_city: "Minneapolis",... |
require 'bic-finder'
require 'minitest/autorun'
require 'minitest/mock'
require 'minitest/spec'
require 'tmpdir'
require 'vcr'
require 'webmock/minitest'
require 'fileutils'
TEST_CACHE_DIR = File.join(Dir.tmpdir, "bic-finder-tests-#{srand}").freeze
FIXTURES_PATH = File.join(File.dirname(__FILE__), 'fixtures').freeze
... |
require 'rails_helper'
RSpec.feature 'Correcting a submission by reporting no business' do
before do
mock_sso_with(email: 'email@example.com')
mock_incomplete_tasks_endpoint!
mock_complete_tasks_endpoint!
mock_task_with_framework_endpoint!
mock_no_business_correction_endpoint!
mock_submission... |
require 'spec_helper'
# I'd much prefer to test these with real SQL queries, but unfortunately the FactoryGirl
# overhead is high and this spec alone was taking like 10 seconds to load.
#
# So instead, I'm testing select bits of the SQL generated by these queries. It's kinda weird
# but I think it does a pretty good ... |
require 'json'
module Miri
class SpeechToText
TRANSLATION_URI = "http://www.google.com/speech-api/v1/recognize?lang=en-us&client=chromium"
def initialize(audio_file)
@audio_file = audio_file
end
def text
@text ||= result["utterance"]
end
def confidence
@confidence ||= re... |
class AddPhotoToContestants < ActiveRecord::Migration
def change
add_attachment :contestants, :photo
end
end
|
#!/usr/local/bin/ruby
# @date November 20, 2016
# @author Dominic Philip
# @abstract Marker: A simple GitHub flavored markdown renderer
# @version 0.1
require 'webrick'
require 'github/markup'
if ARGV[0].nil?
abort 'Please provide the markdown file'
end
path = File.dirname(File.expand_path(ARGV[0])) + '/index.ht... |
class RestaurantSerializer < ActiveModel::Serializer
attributes :id, :name, :created_at, :updated_at
def created_at
object.created_at.strftime("%Y-%m-%d") if object.created_at.present?
end
def updated_at
object.updated_at.strftime("%Y-%m-%d") if object.updated_at.present?
end
end |
require 'logger'
require 'benchmark'
require 'kungfuig'
require 'hashie/mash'
require "kantox/chronoscope/version"
module Kantox
module Chronoscope
module Generic; end
module Dummy; end
CHAIN_PREFIX = '⚑'.freeze
DEFAULT_ENV = :development
CONFIG_LOCATION = 'config/chronoscope.yml'.freeze
... |
# Code your cash register here!
class AmazonTransaction
attr_accessor :items, :discount, :total
def initialize(d = 0)
@total = 0
@items = []
@discount = d
end
def add_item(title, price, quantity = 1)
self.total += price * quantity
quantity.times do
items << title
end
end
... |
# frozen_string_literal: true
# == Schema Information
#
# Table name: clicks
#
# id :bigint not null, primary key
# browser :string not null
# platform :string not null
# created_at :datetime not null
# updated_at :datetime not null
# url_id :bigint
... |
require_relative 'sliding_piece'
class GodPiece < SlidingPiece
GOD_DIRECTIONS = [1 , -1, 2, -2].permutation(2).to_a.reject { |direc| direc.first.abs == direc.last.abs }
attr_reader :directions
def initialize(color, pos, board_reference)
super
@directions = GOD_DIRECTIONS
end
def render
@color... |
class CreateSto < ActiveRecord::Migration
def change
create_table :sto, id: false do |t|
t.string :uuid, null: false
t.string :vtweg, null: false
t.string :ebeln, null: false
t.string :ebelp, null: false
t.string :matnr, null: false
t.string :werks_from, null: false
t.str... |
# frozen_string_literal: true
module Sleet
class BuildSelector
def initialize(repo:, job_name:)
@repo = repo
@job_name = job_name
end
def build
@build ||= repo.build_for(chosen_build_num)
end
def validate!
must_find_a_build_with_artifacts!
chosen_build_must_have_in... |
class ProviderMailer < ApplicationMailer
def warns
@provider = params[:provider]
mail(to: @provider.email, subject: 'Warns about computer')
end
end
|
# encoding: utf-8
class Author < ActiveRecord::Base
has_many :books, :dependent => :nullify
validates :name, :presence => true,
:uniqueness => true
default_scope order("name ASC")
has_attached_file :photo, :styles => {:medium => "200x275>", :thumb => "125x170>" },
:url => "/sys... |
# Copyright 2013 Ride Connection
#
# 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 applicable law or agreed to in writi... |
class AddImageInfoToImages < ActiveRecord::Migration
def change
add_column :images, :ig_url, :string
add_column :images, :ig_caption, :string
add_column :images, :ig_user, :string
add_column :images, :ig_user_avatar, :string
add_column :images, :ig_video_url, :string
add_column :images, :ig_cr... |
class Admin::PostsController < AdminController
before_action :get_user, only: [:new, :create]
before_action :get_post, only: [:show, :edit, :update, :destroy]
def index
@posts = Post.all(:order => 'created_at DESC')
end
def show
@comments = @post.comments
end
def new
@post = @user.posts.... |
class HeadhuntersController < ApplicationController
before_action :set_headhunter, only: [
:show, :to_validate, :update,
:update_profile, :update_startup, :update_photos, :edit
]
def repertory
if !current_user
session[:redirection_headhunter_sign_in] = "testavem"
authorize Headhunter.find... |
# 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 rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel... |
class Maker < ActiveRecord::Base
has_many :hardwares, dependent: :destroy
has_many :hwstatuses, through: :hardwares
has_many :hwtypes, through: :hardwares
validates :name, presence: true, length: { minimum: 2, maximum: 100 }
# @makers = self.all
# @devices = []
# if @makers.any?
# @makers.each do |m|... |
# frozen_string_literal: true
require "spec_helper"
describe 'Firefox Addons' do
it "Installs and Uninstalls", browser: :firefox do
addon_id = @driver.install_addon("spec/resources/ninja_saucebot-1.0-an+fx.xpi")
@driver.get "https://www.saucedemo.com"
expect(@driver.find_elements(class: 'bot_column2'))... |
require('minitest/autorun')
require('minitest/reporters')
Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new
require_relative("../..river")
require_relative("../..fish")
class RiverTest < MiniTest::Test
def setup()
@river = River.new("Colorado", @fish)
@fish_1 = Fish.new("Salmon")
@fish_2 = Fish.n... |
require File.dirname(__FILE__) + '/Gene'
class Generation
def initialize()
@gene_list = Array.new
end
def gene_list=(value)
@gene_list = value
end
def copy()
g = Generation.new
g.gene_list = @gene_list
return g
end
def gene_size
return @gene_list.size
end
d... |
# -*- encoding: binary -*-
#
# Adapter for Kannel's smsbox daemon (http request)
#
#
# Here's a sample Rack ENV dump from an smsbox request:
#
# {"SERVER_SOFTWARE"=>"thin 1.2.7 codename No Hup",
# "SERVER_NAME"=>"127.0.0.1",
# "rack.input"=>#<StringIO:0x00000102ebd0b8>,
# "rack.version"=>[1, 0],
# "rack.errors"=>#<... |
class CreateCriteria < ActiveRecord::Migration[5.2]
def change
create_table :criteria do |t|
# Use Multiple table inheritance
t.actable
# Unique name given by user
t.string :name
t.boolean :one_time
t.datetime :valid_from
t.datetime :valid_till
t.timestamps
e... |
require 'rails_helper'
RSpec.describe EmailAddress, :type => :model do
let(:email_address) { EmailAddress.new(address: 'email@example.com', person_id: 1) }
it 'is valid' do
expect(email_address).to be_valid
end
it 'is invalid without a number' do
email_address.address = nil
expect(email_address).... |
require 'spec_helper'
describe Genre do
describe "メソッド" do
describe "#regist" do
let(:genre) { create(:top_genre) }
let(:page) { create(:page, genre: genre) }
context "イベントツールプラグインがある場合" do
subject {
create(:page_content_publish, page: page, content:
%Q|<%=... |
class Addlikecount < ActiveRecord::Migration
def change
add_column :photos, :likes_count, :integer, default: 0
Photo.find_each { |photo| Photo.reset_counters(photo.id, :likes) }
end
end
|
class Admin::ConfirmationsController < Devise::ConfirmationsController
include ActiveModel::ForbiddenAttributesProtection
# Authentication filters
prepend_before_filter :require_no_authentication, :only => [ :new, :create, :show ]
before_filter :check_scope_conflict
# GET /admin/confirmation/new
def new
... |
module ActiveRecord
module Acts
module ShareableObject
module DefaultProperties
TWITTER = [
twitter: [
:card,
:title,
:description,
:url,
:image0,
:image1,
:image2,
:image3,
... |
class User < ApplicationRecord
has_many :pets
has_many :transactions
has_secure_password
validates :username, uniqueness: true
end
|
class AddWidthToProducts < ActiveRecord::Migration
def change
add_column :products, :width, :int
end
end
|
# coding: utf-8
require "net/http"
require "uri"
require "json"
class IoTAccess
def initialize(url="http://localhost:55555/iot/")
@url = url
end
def put(key, data)
uri = URI.parse(@url+key)
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Post.new(uri.request_uri)
req["Content-Type"] = "application... |
require_relative('../db/sql_runner.rb')
class Animal
attr_accessor :name, :type, :date_of_birth, :owner_id, :vet_id, :notes
attr_reader :id
def initialize(options)
@id = options['id'].to_i if options['id']
@name = options['name']
@type = options['type']
@date_of_birth = options['date_of_birth']
... |
module Lolita
module Adapter
module FieldHelper
def technical?
if self.name.to_s.match(/^created_at|updated_at|type$/)
true
elsif self.primary?
true
elsif adapter.klass.respond_to?(:uploaders)
adapter.klass.uploaders.keys.include?(name.to_sym)
en... |
class Comment < ActiveRecord::Base
belongs_to :post
validates_presence_of :post, :name, :body
end
|
class CategorySerializer < ActiveModel::Serializer
attributes :bilevel_partition
def bilevel_partition
{ name: "flare",
children: [
name,
children
]
}
end
def name
object.large
end
def children
[
{ name: object.middle },
grandchildren
]
end
... |
# frozen_string_literal: true
require "rails_helper"
RSpec.describe TableOfContentsBuilder do
context "when requesting a full table of contents" do
it "generates a pruned JSON document of the collection components with no top level component" do
document = SolrDocument.find("MC221_c0004")
output = de... |
module AngellistApi
class Client
# Defines methods related to URLs
#
# @see http://angel.co/api/spec/reviews
module Reviews
# Return reviews for the given user. If no user given, the authenticated
# user is used. Reviews are paginated and ordered by most recent first.
# Also returns ... |
# RELEASE 2: NESTED STRUCTURE GOLF
# Hole 1
# Target element: "FORE"
array = [[1,2], ["inner", ["eagle", "par", ["FORE", "hook"]]]]
# attempts:
# ============================================================
p array[1][0] # "inner"
p array[1][1] # ["eagle", "par", ["FORE", "hook"]]
p array[1][1][2] # ["FORE", "hook"]... |
class CreateJoinTableScenesUsers < ActiveRecord::Migration
def change
create_table :scenes_users, id: false do |t|
t.belongs_to :scene, index: true
t.integer :fb_user_id, limit: 8, index: true
t.timestamps
end
add_index :scenes_users, [ :scene_id, :fb_user_id ], unique: true
end
end |
feature "the values displayed on procurements" do
scenario "requester can see procurement details" do
requester = create(:user, :beta_active, client_slug: "gsa18f" )
supervisor = create(:user, client_slug: "gsa18f", email_address: "supervisor@gsa.gov", first_name: "super")
login_as(requester)
visit n... |
require 'rails_helper'
Dir[Rails.root.join('lib/tasks/**/*.rb')].each { |f| require f }
module TaskSupport
describe Importer do
it 'instantiates a new SportFetcher' do
allow(Importer::SportFetcher).to receive :new
Importer.new 'league'
expect(Importer::SportFetcher).to have_received(:new)
e... |
class CompetitionEntriesController < ApplicationController
def create
if params[:competition_id] and params[:team_id]
begin
competition = Competition.find(params[:competition_id])
team = Team.find(params[:team_id])
if competition.can_team_be_signed_up? team
wrong_user =... |
require 'rails_helper'
RSpec.describe ClientContactType, type: :model do
it 'has a valid factory' do
expect(create :client_contact_type).to be_valid
end
end
|
class AddCurrencyToQuotationLine < ActiveRecord::Migration[5.1]
def change
add_column :quotation_lines, :currency, :string
end
end
|
require "spec_helper"
describe "feeder/items/_item.html.erb" do
helper(Feeder::AuthorizationHelper)
before do
render partial: "feeder/items/item.html.erb", locals: {
item: item
}
end
context "recommended item" do
let(:message) { create :message }
let(:item) { create :feeder_item, fee... |
class Instructor < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
has_one :school_instructor
has_one :school, th... |
module ApplicationHelper
# returns the gravatar image for a given user. You can also specify the size.
# Example: gravatar_for(@user, size: 190)
def gravatar_for(user, options = {size: 80})
gravatar_id = Digest::MD5::hexdigest(user.email.downcase)
size = options[:size]
image_tag "http://gravatar.com/... |
require 'rails_helper'
RSpec.describe Sword::Endpoints::MetsToHyacinthEndpoint do
########################################## Initial state
describe 'Initial state' do
context '#initialize' do
it 'sets @mets_parser to a new instance of MetsParser' do
expect(described_class.new(Collection.new,
... |
class Admin::ProjectsController < Admin::ApplicationController
before_filter :find_project, :except => [:product_projects, :new, :index, :list, :add, :show_project, :show_task, :show_users, :change_password]
include Base
def new
@project = Project.new(params[:project])
if request.get?
return render(... |
# frozen_string_literal: true
class NamespacesController < ApplicationController
include ChangeNameDescription
before_action :set_namespace, only: %i[change_visibility show update]
after_action :verify_authorized, except: %i[index typeahead]
after_action :verify_policy_scoped, only: :index
# GET /namespac... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.synced_folder "./data", "/vagrant_data"
config.vm.define "dev" do |dev|
dev.vm.box_url = "h... |
class Pokemon < ApplicationRecord
belongs_to :generation, optional: true
validates :name, :pokedex_number, :image, :generation_num, :type_one, :height, :weight,
presence: true
end
|
class Device < ApplicationRecord
USERS = [['ux', 'Usability Lab'], ['dev', 'Project'], ['demo', 'Showcase']]
OSS = { ios: 'iOS', android: 'Android', others: 'Other OS'}
BRAND = [['Apple', 'apple'], ['Samsung', 'samsung'], ['LG', 'lg']]
has_attached_file :photo
validates_attachment_content_type :photo, conten... |
Given /^I have yet to enter my card details$/ do
#pending
end
Then /^my card type should be '(.*)'$/ do |card_type|
$browser.span(id: 'type').text.should match card_type
end
Then /^I should not have a card type$/ do
$browser.span(id: 'type').text.should be_empty
end
Then /^I should not see 'not supported'$/ do... |
require "spec_helper"
describe HashService do
let(:hash_service){ HashService.new }
let(:md5){ "ea702ba4205cb37a88cc84851690a7a5" }
let(:response_hash){ {"md5" => md5} }
describe "#md5" do
context "real web" do
before(:all) do
WebMock.allow_net_connect!
end
after(:all) do
... |
#
# Deploying with Capistrano
#
# On a virgin machine make sure to
# 0. export CAP_EC2_DEPLOY_HOST=<your host>
# export CAP_EC2_DEPLOY_ENV=<your env>
# SSH into the server, append your ~/.ssh/id_rsa.pub to server's ~/.ssh/authorized_keys
#
# make sure your cap version is rqual to 2.15.5
# make sure forever ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.