text
stringlengths
10
2.61M
require 'lib/rovi' class Album < Rovi attr_accessor :album attr_reader :original_artist, :original_album # @param [String] artist name # @param [String] album name def initialize(artist, album) super() @original_artist = artist @original_album = album params = { :query => "#{original_artist...
require 'memoist' require 'active_model' Rack::Attack class Rack::Attack class << self extend Memoist def all_keys store, namespace = cache_store_and_namespace_to_strip keys = store.keys if namespace keys.map { |key| encode_to_utf8(key).to_s.sub(/^#{namespace}:/, '') } ...
# frozen_string_literal: true require_relative 'score' require_relative 'valid_score' class Player include ValidScore attr_reader :name, :global_scores attr_accessor :scores def initialize(name) @name = name @scores = [] @global_scores = (1..10).map { |n| [n, -1] }.to_h end def add_score(poin...
require 'rails_helper' require 'support/xero_helper' RSpec.describe Xero::ContactPullJob do include XeroHelper subject(:job) { described_class.new } around { |spec| with_xero_cassette { spec.run } } it 'should fetch only recent updates' do contact = create :xero_contact, { id: "c0a64e06-4d52-4d8c-...
#!/usr/bin/env ruby require "sqlite3" require "optparse" OptionParser.new do |opts| opts.banner = "Usage: #{__FILE__} [-d /path/to/database]\nDisplay the contents of a database." opts.on("-h", "--help", "Display this message.") {puts opts; exit} $database = "#{ENV["MYGROUP"]}/obsids.sqlite" opts.on("-d"...
# frozen_string_literal: true module Samples class Person attr_reader :age, :name def initialize(age, name) @age = age @name = name end end end
RSpec.shared_examples "an api controller" do |id_params| describe "rescues from Active::RecordRecordNotFound" do context "on GET #show" do before { get :show, id_params } it { expect(response).to have_http_status(404) } it { expect(response.body).to match(/Couldn't find/) } end context...
require 'spec_helper' describe Teacher do it { should have_many(:teacher_memberships) } it { should have_many(:blocks) } end
class Student < ApplicationRecord validates :name, presence: true validates :rollNumber, uniqueness: true, presence: true validates :departmentId, presence: true end
class TasksController < ApplicationController before_action :set_task, only: [:show, :edit, :update, :destroy, :done, :performed, :remake ] before_action :set_team, except: [:index] # def index # @team = Team.find(params[:team_id]) # @tasks = @team.tasks # end def show authorize @task task_v...
# frozen_string_literal: true module Files class EmailPreference attr_reader :options, :attributes def initialize(attributes = {}, options = {}) @attributes = attributes || {} @options = options || {} end # email - Email address def email @attributes[:email] end # arr...
class AddPostByToBlogs < ActiveRecord::Migration[5.0] def change add_column :blogs, :post_by, :string end end
# == Schema Information # # Table name: branches # # id :integer not null, primary key # name :string # number :string # status :integer # section_id :integer # created_at :datetime not null # updated_at :datetime not null # # Indexes # # index_branches_on_section_...
class FontAdinathaTamilBrahmi < Formula head "http://www.virtualvinodh.com/download/Adinatha-Tamil-Brahmi.zip" desc "Adinatha Tamil Brahmi" homepage "http://www.virtualvinodh.com/wp/tamil-brahmi-font/" def install parent = File.dirname(Dir.pwd) != (ENV['HOMEBREW_TEMP'] || '/tmp') ? '../' : '' (share/"f...
module Omada module API module Actions module Create class Team include Dry::Transaction step :validate_params step :validate_user_token step :validate_uniq_team_name step :save private def validate_params(params) ...
class AddDescriptionAndConfigurationTypeIdToConfiguration < ActiveRecord::Migration def change add_column :configurations, :description, :string add_column :configurations, :type_id, :integer end end
require 'rails_helper' RSpec.describe Batch, type: :model do describe "validations" do it { is_expected.to validate_presence_of(:name) } it { should validate_uniqueness_of(:name) } it { is_expected.to validate_presence_of(:start_date) } it { is_expected.to validate_presence_of(:end_date) } end ...
module Turing class Parser def self.parse(str) new(str).to_configurations end def initialize(machine_spec) @machine_spec = machine_spec end def split_lines lines = @machine_spec.split("\n") lines.reject{ |line| line.strip.empty? || line[/^\s*#/] } end private :sp...
module DataMigrations class Instruction autoload :Base, 'data_migrations/instruction/base' autoload :Copy, 'data_migrations/instruction/copy' autoload :Exec, 'data_migrations/instruction/exec' autoload :Remove, 'data_migrations/instruction/remove' autoload :Set, 'data_migrations/instructi...
template "/etc/monit.d/nfs_server.monitrc" do owner 'root' group 'root' mode 0644 source 'monit_nfs.erb' notifies :restart, "service[monit]" end service 'monit' do action :start end
require_relative 'tables' class Kill < Table table_name 'kills' column :killer_id column :victim_id prep_generic_stmts def initialize(db_hash) super(db_hash) end def self.create_new_kill(kill_info) insert [kill_info[:killer_id], kill_info[:victim_id]] end end
namespace :tweets do desc "TODO" task delete_10_days_old: :environment do Tweet.where(['created_at < ?', 10.days.ago]).destroy_all end end
class SmsNotification < Notification validates_format_of :destination, :with => /^(\(\d{3}\)|\d{3})-?\d{3}-?\d{4}$/ def destination=(destination) self[:destination] = destination.gsub(/\D/, '') end def self.label "Phone Number for SMS Notification" end def self.placeholder "3175551234" e...
module SimStats class << self # Setting.deliveryCount = 0 # Setting.totalDeliveryTime = 0 # Setting.simulationStartTime = 0 # Setting.initalized = false # Setting.droneTransitTime = 0 # Setting.droneTransitCount = 0 # Setting.droneStartDeliveryTime = {} ...
module Neo4j::Server # Plugin Neo4j::Session.register_db(:server_db) do |*url_opts| Neo4j::Server::CypherSession.open(*url_opts) end class CypherSession < Neo4j::Session include Resource include Neo4j::Core::CypherTranslator alias_method :super_query, :query # Opens a session to the...
class User < ApplicationRecord authenticates_with_sorcery! attr_accessor :password, :password_confirmation validates :email, uniqueness: true has_many :authentications, dependent: :destroy accepts_nested_attributes_for :authentications has_one :dog, dependent: :destroy def line_uid authenticati...
class Post < ApplicationRecord DEFAULT_REWARD = 100 DEFINED_STATES = %w[open closed].freeze MAX_REWARD = 500 MIN_REWARD = 0 BODY_MAX_CHARS = 10000 CODE_MAX_CHARS = 10000 TITLE_MAX_CHARS = 100 SOURCE_URL_MAX_CHARS = 140 before_save :set_default_reward validates :title, presence: true, length: { maxi...
class BulkDiscount < ApplicationRecord belongs_to :merchant validates :percentage_discount, presence: true, numericality: true validates :quantity_threshold, presence: true, numericality: true def self.max_discount(quantity) where('quantity_threshold <= ?', quantity) .order(percentage_discount: :des...
require 'rails_helper' RSpec.describe CreateCustomer do include ModelHelper after do Customer.destroy_all end it 'Create Customer interactor exists' do expect(class_exists?(CreateCustomer)).to eq(true) end it 'successful create' do result = CreateCustomer.call(response: {authenticated: true},...
require 'rails_helper' require 'factories/user' RSpec.describe User, type: :model do def build_and_validate_user user = build(:user) user.validate! user end let(:user) { create(:user) } let(:patient) { create(:patient, user_id: user.id) } it { is_expected.to validate_presence_of(:firstname) }...
# encoding: UTF-8 # Copyright 2012 Twitter, Inc # http://www.apache.org/licenses/LICENSE-2.0 require 'base64' module TwitterCldr module Utils module RegexpAst def self.load(ast_str) Marshal.load(Base64.decode64(ast_str)) end def self.dump(ast) Base64.encode64(Marshal.dump(as...
require 'test/unit' require 'repub' require 'repub/app' class TestFetcher < Test::Unit::TestCase include Repub::App::Fetcher attr_reader :options def setup @url = 'file://' + File.expand_path(File.join(File.dirname(__FILE__), 'data/test.html')) @options = { :url => @url, # NO...
# Implement your procedural solution here! def palindrome?(number) number.to_s == number.to_s.reverse end def largest_palindrome_product(range = 1..999) array = [] range.each do |x| range.each do |y| array.push(x * y) end end array.select { |n| palindrome?(n) }.max end
class UserMailer < ActionMailer::Base default :from => "\"Warnock and Polivka Inc\" <hello@victoryframework.com>" def expire_email(user) mail(:to => user.email, :subject => "Subscription Cancelled") end def subscription_signup(user, subscription) @user = user @subscription = subscription mai...
class Translation def self.to_codons(rna, codons=[]) # could be slow for large strands since Ruby does not have TCO rna.length == 0 ? codons : (to_codons(rna[3, rna.length], codons.push(rna[0,3]))) end def self.of_codon(codon) CODON_PROTEIN[codon.to_sym] end def self.of_rna(strand) proteins = t...
require 'sinatra' require "sinatra/reloader" require 'pp' require 'Open3' load 'runcommand.rb' enable :run def parse_env(e) # # parse the output of docker env machine into something meaningful # # export DOCKER_TLS_VERIFY="1" # export DOCKER_HOST="tcp://45.55.67.122:2376" # export DOCKER_CERT_PATH="/Users/a/.d...
require_relative 'instance_counter' require_relative 'validation' require_relative 'accessors' class Station include InstanceCounter include Validation extend Acсessors attr_accessor_with_history :name attr_reader :name, :trains validate :name, :presence validate :name, :format, /^[a-zA-Z]+$/i @@statio...
require 'van.rb' describe Van do let(:bike) {double :bike} let(:broken_bike) {double :bike, broken?: true} let(:working_bike) {double :bike, broken?: false} let(:station){double :station, bikes: [working_bike, broken_bike], is_a?: true} let(:van) {Van.new} it 'should accept a bike' do expect(van.bike_coun...
FactoryGirl.define do factory :version do sequence(:name) { |n| "Version#{n}" } end end
require 'nokogiri' require 'byebug' require 'open-uri' class Page attr_accessor :category_url, :category_pages, :links USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_0) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.854.0 Safari/535.2" BASE_URL = "http://www.trademe.co.nz" def initialize(url...
require File.expand_path(File.dirname(__FILE__) + "./../test_helper") class GroupPostTest < ActiveSupport::TestCase should_belong_to :group should_belong_to :user should_have_many :group_post_comments, :dependent => :destroy should_have_many :group_files, :dependent => :destroy should_validate_presence_of :...
# frozen_string_literal: true require 'test_helper' module Vedeu module DSL describe Truncate do let(:described) { Vedeu::DSL::Truncate } let(:instance) { described.new(_value, options) } let(:_value) { 'abcdefghijklmnopqrstuvwxyz' } let(:options) { { name: ...
# 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: 'Lord of the Rings' }]) # Ch...
require 'garb' class GoogleAnalytic < ActiveRecord::Base belongs_to :campaign validates_presence_of :title validates_presence_of :tracking_code Garb::Session.login('maloney.mc', 'trinity53') def profile Garb::Profile.first(self.tracking_code) end def profile_title Garb::Profile.fir...
class SignInController < PopupController attr_accessor :signInButton stylesheet :signInView layout do self.view = layout(SignInView, :root, controller: self) end def viewWillAppear(animated) @signInButton = GUI.squareBarButtonWithTitle _("Sign in"), target:self, action:"signIn" self.navigation...
class Album < ActiveRecord::Base ALBUM_TYPE = [ 'LIVE', 'STUDIO' ] attr_accessible :title, :type, :band_id validates :title, :type, :band_id, :presence => true belongs_to :band has_many( :recordings, :foreign_key => :track_id, :class_name => "Track", :dependent => :destroy ) end
class CreateExData < ActiveRecord::Migration[5.0] def change create_table :ex_data do |t| t.belongs_to :image, index: true t.text :data_1 t.timestamps end end end
require_relative "../repository" require_relative "../models/rental" class RentalRepository < Repository self.model = Rental protected def load_instance_relations(instance, cars:) instance.car = cars.fetch(instance.car_id) end end
class CreateImages < ActiveRecord::Migration def self.up create_table :images do |t| t.string :filename t.string :base_url, :null => false t.integer :revision, :default => 0 t.boolean :uploaded, :default => false t.timestamps end end def self.down drop_table :images en...
FactoryGirl.define do factory :ipsum do theme "tester" motto "test ipsum for rspec" color "entertainment" image "testwebsite.com" accent "streetviewhere" phrases "words on words" end end
class User < ActiveRecord::Base # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable validates :full_name, presence: true validates_form...
# email:string # password_digest:string # password:string virtual # password_confirmation:string virtual class User < ApplicationRecord has_many :twitter_accounts has_many :tweets has_secure_password validates :email, presence: true, format: { with: /\A[\w.+-]+@\w+\.\w+\z/, message: 'enter valid email addre...
require 'pry' GOOD_TROOPS_VALUE = [1, 2, 3, 3, 4, 10].freeze EVIL_TROOPS_VALUE = [1, 2, 2, 2, 3, 5, 10].freeze def goodVsEvil(good, evil) num_good_troops = 0 num_evil_troops = 0 good.split.each_with_index do |number_of_troops, index| num_good_troops += number_of_troops.to_i * GOOD_TROOPS_VALUE[index] end...
require 'open-uri' require 'zip' require 'pp' class ItaTaxonomyData include Importable include VersionableResource # This is the staging URL, need to make sure this gets changed to prod PROTEGE_URL = 'http://52.4.82.207:8080/webprotege/download?ontology=0aa09276-58a6-4350-a0bb-60eb2ab4be00' def initialize(...
class AddNewHotelsTd < ActiveRecord::Migration def change add_column :hotels, :has_food, :boolean add_column :hotels, :has_kettle, :boolean add_column :hotels, :has_sunbeds, :boolean add_column :hotels, :has_playground, :boolean end end
Rails.application.routes.draw do get 'notifications/index' devise_for :admin_users, ActiveAdmin::Devise.config ActiveAdmin.routes(self) mount Ckeditor::Engine => '/ckeditor' devise_for :users, :controllers => { registrations: 'registrations' } # The priority is based upon order of creation: first created -...
require 'spec_helper' describe Sitemap::Crawler do let(:url) { "http://dash-it-app.herokuapp.com" } let(:subject) { c = Sitemap::Crawler.new c.url = url c } let(:raw_links) { ["/users/sign_up","/users/password/new","http://twitter.com","#some_div","mailto:me@me.com"] } describe ".crawl" do ...
class Ability include CanCan::Ability def initialize(user) user ||= User.new # guest user (not logged in) if user.has_role? :admin can :manage, :all elsif user.has_role? :pharmacy_admin can :manage, :all elsif user.has_role? :pharmacist, :technician can :manage, [Prescription, Rem...
class FinancialYear < ActiveRecord::Base # FinancialYear is made a timeline # # by default full timeline is Default Financial Year # when first FinancialYear (FY1) is created, timeline before the start date of FY1 is default financial year # any associated model with nil as financial_year_id is treated as assoc...
module Cask::Source; end require 'cask/source/gone' require 'cask/source/path' require 'cask/source/tap' require 'cask/source/uri' module Cask::Source def self.sources [ Cask::Source::URI, Cask::Source::Path, Cask::Source::Tap, Cask::Source::Gone, ] end def self.for_query(query)...
class Movie < ApplicationRecord has_many :ratings has_many :users, through: :ratings validates :api_id, uniqueness: true end
require 'spec_helper' class MockGQLInterface include GQLi::DSL end describe GQLi::DSL do subject { described_class } describe 'module level methods' do describe '::query' do it 'can create a query without name' do query = subject.query { someField } expect(query).to...
class HNSnap include MongoMapper::Document key :time_snapped, Time key :items, Array end
require 'orocos/test' describe Orocos::Local::NameService do before do @task = Orocos::TaskContextBase.new("Local/dummy") @service = Orocos::Local::NameService.new [@task] end after do Orocos.clear end describe "when asked for task names" do it "must return all re...
class FoodItem < ActiveRecord::Base has_many :orders, dependent: :destroy def image_url_or_auto if image_url.present? image_url else "http://loremflickr.com/320/240/#{name}" end end def self.filter_by_section(section) if !section.present? or section.eql? 'All' all else where("sections ILIKE...
def count(array) counter = 0 array.each do |num| counter += 1 if yield(num) end counter end p count([1,2,3,4,5]) { |value| value.odd? } == 3 p count([1,2,3,4,5]) { |value| value % 3 == 1 } == 2 p count([1,2,3,4,5]) { |value| true } == 5 p count([1,2,3,4,5]) { |value| false } == 0 p count([]) { |value| valu...
class Equipment < ApplicationRecord has_many :drink_equipments has_many :drinks, through: :drink_equipments end
#app to demonstrate use of double-quoted strings buffy_quote_1 = '\'Kiss rocks\'? Why would anyone want to kiss... Oh, wait. I get it.' buffy_quote_2 = "'Kiss rocks'?\n" + "Why would anyone want to kiss...\n" + "Oh, wait. I get it." puts buffy_quote_1 p...
class PurchaseOrderSerializer < ActiveModel::Serializer attributes :id, :supplier_id, :warehouse_id, :dt_expected, :status, :comment, # methods :total_amount has_many :purchase_order_items end
# ハッシュとは p( {:coffee => 300, :coffee_latte => 400} ) # シンボルとは p "coffee".to_sym p "coffee".to_s # ハッシュには2種類の書き方がある {:coffee => 300, :coffee_latte => 400} #シンボル以外のオブジェクトを使う時に使う {coffee: 300, coffee_latte: 400} #シンボルを指定した時のみ使える # 変数に代入してハッシュに名前をつける menu = {:coffee => 300, :coffee_latte => 400} p menu # ハッシュから値を取得する m...
require 'rails_helper' RSpec.describe Article, type: :model do subject { described_class.new(title: "Texto", text:"Bla bla bla") } it "is valid with valid atributes" do expect(subject).to be_valid end it "is not valid without a title" do subject.title = nil expect(subject).to_not be_valid en...
class AddFieldsToCryptocurrencies < ActiveRecord::Migration[6.1] def change add_column :cryptocurrencies, :total_volume, :integer add_column :cryptocurrencies, :prices_updated_at, :datetime end end
cask :v1 => 'wkhtmltopdf' do version '0.12.2' sha256 'f53fc73dde8eee05a3a3c05e9666123e5e71fef77b8b658f78801a9a8223b6a9' url "http://downloads.sourceforge.net/project/wkhtmltopdf/#{version}/wkhtmltox-#{version}_osx-cocoa-x86-64.pkg" name 'wkhtmltopdf' homepage 'http://wkhtmltopdf.org/' license :gpl pkg "...
# encoding: UTF-8 # Copyright 2017 Max Trense # # 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 agre...
require 'spec_helper' describe Team do let(:team) { Team.new(:name => "Recipe") } before(:each) do team.home_games << Game.new(:home_team_score => 1, :visiting_team_score => 0) team.home_games << Game.new(:home_team_score => 0, :visiting_team_score => 1) team.home_games << Game.new(:home_team_score =...
module Fog module Compute class Vsphere class Real def vm_take_snapshot(options = {}) raise ArgumentError, "instance_uuid is a required parameter" unless options.key? 'instance_uuid' raise ArgumentError, "name is a required parameter" unless options.key? 'name' vm = get...
class Message < ApplicationRecord belongs_to :sender, class_name: "User", foreign_key: "sender_id" belongs_to :receiver, class_name: "User", foreign_key: "receiver_id" validates :content, presence: true, unless: :image? mount_uploader :image, ImageUploader end
module OutlookCalendar class UserEvents attr_reader :token, :params, :calendar_id def initialize(token, params, calendar_id = nil) @token = token @params = params @calendar_id = calendar_id end def call events end private def events ParseEventResponse.new(...
json.array!(@money_arrival_files) do |money_arrival_file| json.extract! money_arrival_file, :id, :filename, :file_raw, :business_type, :main_object_id, :content_type, :user_id json.url money_arrival_file_url(money_arrival_file, format: :json) end
class CreateCorrections < ActiveRecord::Migration def change create_table :corrections do |t| t.timestamps null: false t.text :content, null: false t.datetime :accepted_at t.text :original end add_reference :corrections, :answer, index: true add_reference :corrections, :user, ...
require 'rails_helper' module Services describe AlbumService do class DummyClient def all_albums [ AlbumFromApi.new('Hybrid Theory', 'rock', 'Linkin Park 1'), AlbumFromApi.new('Riot!', 'rock', 'Paramore 2') ] end end class DummyAllocator def album_cl...
require 'active_support/core_ext' require 'erubis' require 'tilt' require 'temple' module Curtain class OutputBuffer < ActiveSupport::SafeBuffer def <<(value) super(value.to_s) end alias :append= :<< alias :safe_append= :<< alias :safe_contact :<< end end module Curtain class Erubis < ...
class AddSourceAgentToAgents < ActiveRecord::Migration[5.1] def change add_column :agents, :source_agent, :string end end
# Cookbook Name:: oracle-instantclient # Mixin:: alien_converter # Author:: David Kinzer <dtkinzer@gmail.com> # # Copyright (C) 2014 David Kinzer # # 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 ...
require "./display_impl.rb" class StringDisplayImpl include DisplayImpl def initialize(string:) @string = string @width = string.bytesize end def raw_open pritn_line end def raw_print puts "| #{string} |" end def raw_close pritn_line end private attr_accessor :string, :wi...
## Looking at cost of SecureRandom functions # htmldrum ☆ ~/code/htmldrum/tests $ ./test ./ruby/secure_random.rb # Rehearsal ----------------------------------------------------------------------- # SecureRandom.uuid, 1000000 times 6.650000 0.390000 7.040000 ( 7.164103) # SecureRandom.hex(50), 1000000 time...
class AddPageIdToCoverImages < ActiveRecord::Migration def change add_reference :cover_images, :page, index: true end end
require 'test_helper' class JournalImagesControllerTest < ActionController::TestCase setup do setup_json_api setup_default_profiles @dragon = profiles(:dragon_profile_1) @profile = @dragon @user = @profile.user @journal = journals(:dragon_journal_1) # Cleanup if necessary ...
module ComplianceReportsHelper def status(compliance_percentage) =begin case compliance_percentage when 0..20 "fail" when 20..50 "warning" when 50..80 "pass" else "exceptional" end =end case compliance_percentage when 0..20 "fail" end end def overall_compliance_barc...
# frozen_string_literal: true require "json" require "uri" require "net/http" require "forwardable" require "toxiproxy/toxic" require "toxiproxy/toxic_collection" require "toxiproxy/proxy_collection" class Toxiproxy extend SingleForwardable DEFAULT_URI = "http://127.0.0.1:8474" VALID_DIRECTIONS = [:upstream, ...
module SolitaireCipher class LetterMap def initialize(cipher_string) @cipher_string = cipher_string end def to_a @cipher_string.upcase .tr('^A-Z',"") .each_char .map { |char| char.ord-"A".ord+1 } end end end
require 'vocabularise/generic_algorithm' module VocabulariSe class ControversialAlgorithm < GenericAlgorithm # limit the number of considered articles for computation ARTICLE_LIMIT = 3 def tag_hotness config, tags_arr links = [] search_expr = '"%s"' % tags_arr.sort.join('" AND "') puts search_expr ...
module AccompanimentHelper def accompaniment_user_details(accompaniment) user = accompaniment.user [user.phone, user.email].tap do |details| details << user.volunteer_type.humanize.titleize if user.volunteer? details << accompaniment.availability_notes if accompaniment.availability_notes.present? ...
# n Place a value n in the "register". Do not modify the stack. # PUSH Push the register value on to the stack. Leave the value in the register. # ADD Pops a value from the stack and adds it to the register value, storing the result in the register. # SUB Pops a value from the stack and subtracts it from the register v...
# frozen_string_literal: true require "logger" module LiteCable module Logging # :nodoc: PREFIX = "LiteCable" class << self def logger return @logger if instance_variable_defined?(:@logger) @logger = LiteCable.config.logger return if @logger == false @logger ||= ::Lo...
# encoding: utf-8 require File.expand_path("../spec_helper", __FILE__) describe "Pre" do before :each do browser.goto(WatirSpec.files + "/non_control_elements.html") end # Exists method describe "#exist?" do it "returns true if the 'p' exists" do browser.pre(:id, "rspec").should exist bro...
## audit_log OWNER_TYPE_USER = 1 OWNER_TYPE_WINE = 2 OWNER_TYPE_WINERY = 3 OWNER_TYPE_WINE_REGISTER = 4 OWNER_TYPE_PHOTO = 5 ## info_items INFO_TYPE_WINEMAKER = 1 INFO_TYPE_HISTORY = 2 ## audit_log OWNER_TYPES = { OWNER_TYPE_USER => 'user', OWNER_TYPE_WINE => 'wine', OWNER_TYPE_WINERY => 'winery', OWNER_TYPE_W...
class Item < ActiveRecord::Base has_many :inventories validates :itemnumber, uniqueness: true validates :desc1, presence: true end
require('test_helper') || require_relative('../test_helper') require 'date' class Vaadin::DatePickerTest < Minitest::Test include Vaadin::ViewHelpers # note there is no id in here for test purposes class Thing attr_accessor :date def initialize @date = Date.iso8601("2014-04-21") end end ...
#!/usr/bin/env ruby require 'optparse' require 'fileutils' require 'tempfile' require 'gpgme' require 'yaml' require 'docker' require 'socket' require 'timeout' require 'erb' require 'resolv' require 'open3' require './lib/options.rb' require './lib/file_helpers.rb' def modify_env begin puts 'decrypting vault' ...