text
stringlengths
10
2.61M
require 'detective.rb' require 'mediawiki_api.rb' require 'time' require 'sqlite3' require 'bundler/setup' require 'nokogiri' class PageDetective < Detective def self.table_name 'page' end #return a proc that defines the columns used by this detective #if using this as an example, you probably should copy...
class Service < ApplicationRecord belongs_to :account has_one :agreement end
module Embulk module Parser class Mahout < ParserPlugin Plugin.register_parser("mahout", self) def self.transaction(config, &control) # configuration code: task = { "command" => config.param("command", :string, default: "recommenditembased"), "schema" => config.pa...
class InfrastructuresController < ApplicationController def infrastructure_info infrastructure_info = {} InfrastructureFacade.get_registered_infrastructures.each do |infrastructure_id, infrastructure| infrastructure_info[infrastructure_id] = infrastructure[:facade].current_state(@current_user.id) ...
module MPlayerBundler def mplayer "mplayer2" end def mplayer_dest_basename nil end def bundle_mplayer lt = DylibPackager.new(Pathname.new(%x[which #{mplayer}].strip), mplayer_dest_basename) lt.stage_to(self.binary_dir) end end # A class to deal with binary packaging lifecycle class Packag...
class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception #use_growlyflash before_action :configure_permitted_parameters, if: :devise_controller? before_action :ban_check ...
class AddUserIdToScrimads < ActiveRecord::Migration[5.2] def change add_reference :scrim_ads, :user, foreign_key: true end end
require "libxml" module Bio class LazyBlast class Report include Enumerable attr_reader :program, :version, :db, :query_id, :query_def, :query_len, :statistics def initialize(filename) @filename = filename @reader = LibXML::XML::Reader.file(@filename) @nodes = Enumerato...
class PlayMusicGrazer < PlayGrazer def self.section_url 'http://www.play.com/Music/CD/6-/PreOrderChart.html' end def self.get_platform 'Audio CD' end def self.get_product_data(url) data = super(url) data[:title] = data[:title].sub( / ?-? ?#{Regexp.escape(data[:creator])} ?-? ?/, '')...
feature 'Enter names' do scenario 'submitting names' do visit('/') fill_in :player_1_name, with: "Nabonidus" fill_in :player_2_name, with: 'Sargon of Akkad' click_button 'Submit' expect(page).to have_content "Nabonidus vs. Sargon of Akkad" end end
# frozen_string_literal: true RSpec.describe Api::V1::Admin::BaseController, type: :controller do controller do def index; end Api::V1::Admin::BaseController.const_set(:IMPLEMENT_METHODS, []) end describe '#index' do context 'method is not implemented' do it 'raises error', :authenticated_adm...
# frozen_string_literal: true # Advent of Code 2020 # # Robert Haines # # Public Domain require 'test_helper' require 'aoc2020/monster_messages' class AOC2020::MonsterMessagesTest < MiniTest::Test INPUT = <<~EOINPUT 0: 4 1 5 1: 2 3 | 3 2 2: 4 4 | 5 5 3: 4 5 | 5 4 4: "a" 5: "b" ababbb ...
#! ruby -Ku =begin 2015/08/03 ゲームっぽいものをつくるための準備 その1 基本は入力を受け取って、それを元にして処理することじゃん?_(:3」∠)_ まずは入力を受け取ってみるテストから =end ############################################################################# #変数とか SCEAN_GAME_OVER = 999 #シーン番号 ゲーム終了する SCEAN_HELP = 998 #シーン番号 ヘルプを表示するモード game_scene = 0 #ゲームのシーン...
class BetaInvitation < ActiveRecord::Base #after_create :send_email belongs_to :sender, :class_name => 'User', inverse_of: :sent_beta_invitations has_one :recipient, :class_name => 'User', :foreign_key => 'beta_invitation_id' validates_presence_of :recipient_email validate :recipient_is_not_registered vali...
require 'fast-filter/operation' require 'fast-filter/engine' module FastFilter ENGINES = ['bitmap', 'bloom', 'set', 'disk'] DEFAULT_ENGINE = 'bitmap' DEFAULT_NAMESPACE = "ff:bucket" end
# == Schema Information # # Table name: tournaments # # id :integer not null, primary key # name :string # created_at :datetime # updated_at :datetime # end_date :datetime # type :string # series_max :integer # # Indexes # # index_tournaments_on_type (type) # class Tournament < ...
Rails.application.routes.draw do # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html namespace :api do namespace :v1 do resources :states, only: [:index, :show, :update] do resources :state_days, only: [:index, :create] resources :counties, ...
class NotificationsController < ApplicationController def index @notifications = Notification.where(recipient_id: session[:current_user_id]) end end
class Api::V1::GamesController < ApplicationController skip_before_filter :verify_authenticity_token def index @games = Game.all @user = current_user render json: { user: @user } end def show @game = Game.find(params[:id]) @reviews = @game.reviews.order(:created_at).reverse @user = cu...
#vlt noch teilwörter als eingabe akzeptieren class HangMan attr_reader :currentWord attr_accessor :currentMistakes attr_accessor :currentDisplay attr_accessor :alreadyTried def initialize() @currentWord = File.readlines("/usr/share/dict/words").sample.chomp.downcase # random Word @currentMistakes = 0 # n...
#!/usr/bin/env ruby #encoding: utf-8 require 'pathname' require 'rbconfig' require 'erb' require 'logger' require 'shellwords' $log = Logger.new( '/tmp/rspec3.log' ) TM_PROJECT_DIRECTORY = Pathname( ENV['TM_PROJECT_DIRECTORY'] || Dir.pwd ) TM_BUNDLE_SUPPORT = Pathname( __FILE__ ).dirname.parent SUPPORT_LIBDIR ...
class CartPolicy < ApplicationPolicy def show? user.present? && (record == user || user_has_power?) end def add_item? show? end def update_item? show? end def remove_item? show? end private def user_has_power? user.admin? end end
# frozen_string_literal: true require "economic/proxies/entity_proxy" require "economic/proxies/actions/find_by_handle_with_number" module Economic class OrderLineProxy < EntityProxy include FindByHandleWithNumber def find_by_order(handle) response = request(:find_by_order_list, "orderHandles" => {"O...
class AddSeoToArticlesVideos < ActiveRecord::Migration def change add_column :articles, :seo_title, :string add_column :articles, :seo_description, :string add_column :articles, :seo_keywords, :string add_column :videos, :seo_title, :string add_column :videos, :seo_description, :string add_column :...
class AddUserEmailAndPasswordNullConstraint < ActiveRecord::Migration[5.1] def change change_column_null(:users, :email, false) change_column_null(:users, :password, false) end end
# frozen_string_literal: true module GraphQL module StaticValidation # Default rules for {GraphQL::StaticValidation::Validator} # # Order is important here. Some validators return {GraphQL::Language::Visitor::SKIP} # which stops the visit on that node. That way it doesn't try to find fields on types t...
require './test/test_helper' require 'minitest/autorun' require 'minitest/pride' require './lib/offset_generator' require 'mocha/minitest' class OffsetGeneratorTest < Minitest::Test def test_it_exists offset = OffsetGenerator.new assert_instance_of OffsetGenerator, offset end def test_it_can_format_dat...
class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception before_filter :visits_updates private def visits_updates $redis.incr 'visits' if browser.chrome? $r...
require "spec_helper" RSpec.describe "Day 7: Recursive Circus" do let(:runner) { Runner.new("2017/07") } let(:input) do <<~TXT pbga (66) xhth (57) ebii (61) havc (66) ktlj (57) fwft (72) -> ktlj, cntj, xhth qoyq (66) padx (45) -> pbga, havc, qoyq tknk (41) ...
json.array! @modelos do |modelo| json.CodigoModelo modelo.ID_MODELO json.NomeModelo modelo.MODELO json.NomeEstilo modelo.NOME_ESTILO end
class Fruit < ApplicationRecord attr_accessor :name_prefix belongs_to :seed, optional: true before_create :generate_name after_save :update_seed private def generate_name self.name = if name_prefix.present? [name_prefix, "-", SecureRandom.hex].join else SecureRandom.hex end end ...
class ChangeBuildsTextToLongText < ActiveRecord::Migration def self.up change_column :builds, :output, :text, :limit => 100.megabytes end def self.down change_column :builds, :output, :text end end
require 'rails_helper' feature 'User joins an existing game' do scenario 'successfully' do black_player = create(:user) white_player = create(:user) create(:game, black_player: black_player, white_player: nil) sign_in_as(white_player) visit games_path click_link 'Join' expect(page).to ha...
require "rails_helper" RSpec.describe "Item index", type: :feature do let!(:item) { Fabricate(:item) } it "loads more items when scrolled to the bottom of the page", js: true do default_per_page = Kaminari.config.default_per_page Fabricate.times(default_per_page, :item) expect(Item.count).to be > def...
class ChangeUsersRelationToReguser < ActiveRecord::Migration[5.0] def change rename_column(:reviews, :user_id, :reg_user_id) end end
require 'optparse' require 'colorize' require 'io/console' # # RUBY SHELL: https://www.devdungeon.com/content/enhanced-shell-scripting-ruby # # Get an environment variable puts ENV['SHELL'] # This will hold the options we parse options = {} OptionParser.new do |parser| parser.banner = "Usage: az-cli.rb [options]" ...
def find_or_create_instance(class_name, instance_name) instance = class_name.where(name: instance_name) if instance.blank? instance = class_name.create(name: instance_name) puts "#{instance_name} #{class_name} added." else puts "#{instance_name} #{class_name} exists, hence not added it." end inst...
require_relative 'methods' items = [ { name: 'Mousse à raser', bought: true }, { name: 'chaussetes', bought: false } ] puts "Welcome to your Christmas gift list" user_action = nil while user_action != 'quit' puts "> Which action [list|add|mark|find|delete|quit]?" user_action = gets.chomp case user_action...
# encoding: utf-8 class EncerramentoController < ApplicationController def new_laudo if !session[:voluntario].blank? @visita = Visita.find_or_create_by_voluntario_id_and_numero(session[:voluntario], 8) end @laudo = @visita ? @visita.laudos.build : Laudo.new params[:pagina] = request.fullpath ...
#!/usr/bin/env ruby # :title: Plan-R CLI Command object =begin rdoc (c) Copyright 2016 Thoughtgang <http://www.thoughtgang.org> =end module PlanR module Cli class Command attr_reader :verb attr_reader :descr attr_reader :usage attr_reader :doc attr_reader :completer attr...
#!/usr/local/bin/ruby -w # Programmer: Chris Bunch # mapper-ruby.rb: Solves part of the EP parallel benchmark via the # MapReduce framework as follows: # Input: Takes in ranges of k values to compute over STDIN. # Output: list [l, X_k, Y_k] A = 5 ** 13 S = 271828183 MIN_VAL = 2 ** -46 MAX_VAL = 2 ** 46 def generate_...
# Hiera entry point for the SIMP Compliance Engine # # To activate this hiera backend, add the following to your `hiera.yaml`: # # ```yaml # --- # version: 5 # hierarchy: # - name: SIMP Compliance Engine # lookup_key: compliance_markup::enforcement # # All options are optional # options: # # Ignore ...
class FestivalSerializer < ActiveModel::Serializer attributes :id, :cost, :start, :finish, :minimum_age, :location, :details, :image, :user_ids, :festival_name, :longitude, :latitude has_many :comments has_many :users end
class Fix def self.restaurant_name(restaurant) i = 1 exists_already = true name_fixed = str(restaurant.name) while exists_already exists_already = Restaurant.find_by(name_fixed: name_fixed) if exists_already == nil restaurant.update(name_fixed: name_fixed) else if i == 1 name_fix...
require 'json' module GoCLI # class driver class Driver attr_accessor :driver, :coord, :type def initialize(opts = {}) @driver = opts[:driver] || '' @coord = opts[:coord] || [] @type = opts[:type] || '' end def self.load_all fleet = [] return fleet unless File.file?(...
require 'slack-notifier' module SportNginAwsAuditor class NotifySlack attr_accessor :text, :channel, :webhook, :username, :icon_url, :icon_emoji def initialize(text) self.text = text if SportNginAwsAuditor::Config.slack self.channel = SportNginAwsAuditor::Config.slack[:channel] s...
#!/usr/bin/env ruby require 'bundler/setup' require 'cache_hash' def test1 puts "Testing fetch" c = CacheHash.new(ttl: 3, gc_interval: 1) c[:a] = "its here" sleep 1 puts c.fetch(:a, "its gone!") sleep 1 puts c.fetch(:a, "its gone!") sleep 1 puts c.fetch(:a, "its gone!") sleep 1 puts c.fetch...
# Teskal # Copyright (C) 2007 Teskal class ProjectSweeper < ActionController::Caching::Sweeper observe Project def before_save(project) if project.new_record? expire_cache_for(project.parent) if project.parent else project_before_update = Project.find(project.id) return if...
require 'rails_helper' feature "Approve exmaninee" do scenario "approve valid application" do visit_examinee_details_path_as_admin click_on "Approve" expect(page).not_to have_content(@examinee.user.name) end scenario "decline invalid application" do visit_examinee_details_path_as_admin click...
require 'spec_helper' require 'rest_spec_helper' require 'rhc/commands/sshkey' require 'rhc/config' describe RHC::Commands::Sshkey do let!(:rest_client){ MockRestClient.new } before{ user_config } describe 'list' do context "when run with list command" do let(:arguments) { %w[sshkey list --noprompt ...
# Reverse digits of an integer. # # # Example1: x = 123, return 321 # Example2: x = -123, return -321 # Must take into account possible stack overflows (even though it is Ruby) def reverse(x) number = x.to_s.gsub(/[^\d]/, '') sign = x.to_s.gsub(/[^\+|\-]/, '') reversed_number = (sign + number.to_s.split("").re...
# frozen_string_literal: true # This is a service that handles oauth for users class OauthService def initialize(auth) @auth = auth end def process_user create_or_update_user end private attr_accessor :auth def user_credentials @user_credentials ||= oauth_user_credentials end def cre...
require "minitest/autorun" require_relative "rocket" require 'pry' class RocketTest < Minitest::Test # Write your tests here! def setup @rocket = Rocket.new end def teardown @rocket = nil end def test_lift_off_true # arrange result = @rocket.lift_off expected = true # act asse...
class AddIndexOnMenuLinks < ActiveRecord::Migration def self.up add_index :user_menu_links , [:menu_link_id,:user_id], :name => :on_user_and_link end def self.down remove_index :user_menu_links , :on_user_and_link end end
class PlannerController < ApplicationController def show # TODO add a "review unreviewed courses" button, and a link to each course (w/ reviews) if @current_user.nil? render :inline => "Login to see/edit your planner" and return end @now = Time.now.year @start_year = params[:start] || (@no...
class Users::ProductsController < Users::ApplicationController before_action :set_product, only: [:show, :offer] def index end def show @relate_products = @product.relate_products end def offer end def contact contact = { name: params[:product][:name], quantity: params[:quantity], email: p...
class CommentsController < ApplicationController def create comment = Comment.create(comment_params) redirect_to "/lessons/#{comment.lesson.id}" end private def comment_params params.require(:comment).permit(:text, :image).merge(user_id: current_user.id, lesson_id: ...
FactoryGirl.define do sequence :email do |n| "user#{n}@example.com" end factory :user do email password "password" end factory :account do name "My Personal Account" end factory :membership do user account end factory :signup do sequence(:email) { |n| "arun#{n}@example....
class Dog attr_accessor :id, :name, :breed def initialize(options) @name = options[:name] @breed = options[:breed] @id = nil end def self.create_table sql = <<-SQL CREATE TABLE IF NOT EXISTS dogs ( id INTEGER PRIMARY KEY, name TEXT, breed TEXT ); SQL ...
# -*- coding: utf-8 -*- require 'spec_helper' describe OpensocialWap::Config::GreeDynamicUrl do context "USER_AGENTを変更してfp用のホストにアクセスする場合" do before do @ctx = Object.new @ctx.stub_chain(:request, :mobile?).and_return(true) @ctx.stub_chain(:request, :user_agent).and_return("DoCoMo/2.0 N901iS(c100...
#!/usr/bin/env ruby # This is a script for creating a list of EXIF values from photos. # You must specify output filename. This script will create a .csv file with EXIF values: # # This script is under GNU software licence. # # Author: alpyapple@gmail.com # source: git://github.com/marek-vanco/PhotoStat.git begin r...
class GameCreator include Interactor def call context[:game] = find_or_create_game!.tap do |game| game.users << user end end private delegate :user, to: :context def find_or_create_game! find_game || create_game! end def find_game Game.find_by(users_count: 1) end def crea...
class StartController < ApplicationController #Starting point for any account #Terms - No #Subjects - No def show #grab the first term @term = Term.where(:user_id => current_user.id).first #Go to welcome screen if no terms exists. #If not - go to first subject of fir...
# frozen_string_literal: true # == Schema Information # # Table name: urls # # id :bigint not null, primary key # clicks_count :integer default(0) # original_url :string not null # short_url :string not null # created_at :datetime not null # updated_a...
module Api module V1 class IngredientSerializer < ActiveModel::Serializer type 'ingredient' attributes :name, :description, :measurement_unit, :unit_price, :uid, :company_uid def company_uid object&.company&.uid end def measurement_unit ::Ingredient...
describe "the make a user an admin process" do it "makes a newly created user an admin" do user = FactoryGirl.create(:user) product = FactoryGirl.create(:product) visit products_path click_link 'New Product' fill_in 'Name', :with => 'Decaf' fill_in 'Description', :with => 'Decaf Coffee Tasty' ...
require 'rails_helper' describe Item do before do @item = FactoryBot.build(:item) @item.image = fixture_file_upload('public/images/test_image.png') end describe '商品出品登録' do context '商品出品登録がうまくいくとき' do it '出品画像、商品名、商品の説明、カテゴリー、商品の状態、 配送料の負担、発送元の地域、発送までの日数、販売価格' do expect(@item)...
class PasswordsController < Devise::PasswordsController #layout 'home_index' def set_new_password self.resource = resource_class.new render :layout => false end def create self.resource = resource_class.send_reset_password_instructions(resource_params) yield resource if block_given? if s...
# You are given a binary tree in which each node contains an integer value (which # might be positive or negative). Design an algorithm to count the number of paths that sum to a # given value. The path does not need to start or end at the root or a leaf, but it must go downwards # (traveling only from parent nodes to ...
class CreateItems < ActiveRecord::Migration def up create_table :items do |t| t.references :user t.string :title t.text :description t.timestamps end add_index :items, :user_id end def down drop_table :items end end
require 'fb_graph2' module Api::V1::ActivityFeed #PROD_TOKEN = "#{ENV['FACEBOOK_APP_ID']}|#{ENV['FACEBOOK_APP_SECRET']}" TOKEN = ENV['TOKEN'] FB_PAGE = '1660157410904515' def self.get_fb_feed page = FbGraph2::Page.new(FB_PAGE).authenticate(TOKEN).fetch feed = page.feed response = [] feed.each {...
NUMBS = { 'zero': '0', 'one': '1', 'two': '2', 'three': '3', 'four': '4', 'five': '5', 'six': '6', 'seven': '7', 'eight': '8', 'nine': '9'} def word_to_digit(string) newarr = [] strarr = string.split(' ') strarr.each do |word| if NUMBS.include?(word.to_sym) newarr << NUMBS.values_at(word.to_...
require File.expand_path('../../../../test/test_helper', File.dirname(__FILE__)) class RoutingTest < ActiveSupport::TestCase def test_routing_for_admin with_routing do |set| set.draw do |map| # active_record_browser routing map.connect "/admin", :controller=>"active_rec...
class Onepassword < Cask url 'http://i.agilebits.com/dist/1P/mac4/1Password-4.1.1.zip' homepage 'https://agilebits.com/onepassword' version '4.1.1' sha1 'bf475de1a4c3d70a292e44cb6fb2896ea74f0012' link '1Password 4.app' end
class RockPaperScissorsController < ApplicationController def new @hands = hands end def show @secret_hand = hands.sample @chosen_hand = hands[params[:id].to_i] @result = is_winner? end private def hands # 0 = Rock # 1 = Paper # 2 = Scissor [{ :id => 0, :name => 'Rock', :i...
class ChangeReviewsColumns < ActiveRecord::Migration def change remove_column :reviews, :personal_description change_table :reviews do |t| t.rename :field_description, :cover_description t.rename :location_description, :general_impression end end end
class Post < ActiveRecord::Base belongs_to :user has_many :replies validates_presence_of :title, :content def author user.email end def posted_on created_at.to_formatted_s(:long) end end
RSpec.describe Knight, type: :model do before(:all) do @white_player = create(:user) @black_player = create(:user) end before(:each) do @game = create(:game) @game.white_player_id = @white_player.id @game.black_player_id = @black_player.id @game.save end context 'movement ...
class V1::FestivalSerializer < ActiveModel::Serializer attributes :id, :name, :full_name, :url, :year, :location, :date, :ticket, :camping, :website has_many :artists def full_name "#{object.name} #{object.year}" end end
require 'test_helper' class UsersSignupTest < ActionDispatch::IntegrationTest setup do ActionMailer::Base.deliveries.clear end test 'signup with invalid data' do get signup_path assert_no_difference 'User.count' do post signup_path, params: { user: { name: '', surname: '', ...
# code here! class School def initialize(name) @name = name @roster = {} end def roster @roster end def grade(school_grade) @roster[school_grade] end def sort @roster.each_value do |value| value.sort! end end def add_student(student_name, student_grade) @roster[s...
# encoding: UTF-8 # Copyright 2012 Twitter, Inc # http://www.apache.org/licenses/LICENSE-2.0 module TwitterCldr module Localized autoload :LocalizedArray, 'twitter_cldr/localized/localized_array' autoload :LocalizedHash, 'twitter_cldr/localized/localized_hash' autoload :LocalizedDate, 'twitte...
Rails.application.routes.draw do mount JasmineRails::Engine => '/specs' if defined?(JasmineRails) # For details on the DSL available within this file, # see http://guides.rubyonrails.org/routing.html # ACTIVEADMIN ROUTES ActiveAdmin.routes(self) # USERS / DEVISE devise_for :users, controllers: { reg...
class ApiResponse API_RESPONSES = YAML.load_file( "#{Rails.root.to_s}/config/api_responses.yml" ).with_indifferent_access class << self def replace_response(response, args) args.inject(response) do |replaced_response, (key, val)| replaced_response.gsub(/{#{key}}/, val.to_s) end en...
class DatacenterVipAssignmentsController < ApplicationController # sets the @auth object and @object before_filter :get_obj_auth before_filter :modelperms # GET /datacenter_vip_assignments # GET /datacenter_vip_assignments.xml def index ## BUILD MASTER HASH WITH ALL SUB-PARAMS ## allparams = {} ...
class Api::V1::CarsController < ApplicationController respond_to :json include Roar::Rails::ControllerAdditions def index car = Car.where(car_slug: params[:car_slug]).first respond_with car , represent_with: Api::V1::CarRepresenter, track: "tset" end private def track_params params.permit(:car...
class Event < ActiveRecord::Base belongs_to :user validates :event_name, presence: true, length: {minimum: 2, maximum: 25} validates :description, presence: true, length: {minimum: 2, maximum: 200} validates :date, presence: true, length: {minimum: 2, maximum: 15} validates :time, presence: true, length: ...
require 'crawler_rocks' require 'pry' require 'json' require 'iconv' require 'book_toolkit' require 'thread' require 'thwait' class ApexBookCrawler include CrawlerRocks::DSL ATTR_HASH = { "ISBN-13" => :isbn, "出版商" => :publisher, } def initialize update_progress: nil, after_each: nil @update_prog...
# coding: utf-8 require 'spec_helper' RSpec.describe Apress::Images::FormTagHelper, type: :helper do describe '#image_field_tag' do subject { helper.image_field_tag('img', subject_type: 'Foo', model: 'Bar') } it 'renders file field tag' do is_expected.to have_tag( :input, with: { ...
require 'test_helper' class V1::SupplementsControllerTest < ActionDispatch::IntegrationTest setup do @supplements = create_list :supplement, 3 end test 'should get index' do get supplements_url assert_equal @supplements.count, json_response.count assert_response :success end test 'should g...
class AdminsController < ApplicationController before_action :authenticate_admin!, only: [:show] def show @admin = Admin.find(params[:id]) @preschools = @admin.preschools end def index end end
# encoding: UTF-8 # The default recipe, included by all other recipes PRIOR to anything else node.default['chef_client']['locale'] = 'en_US.UTF-8' include_recipe 'chef-sugar' include_recipe 'locale' ENV['LANG'] = node['locale']['lang'] ENV['LC_ALL'] = node['locale']['lang'] node.default['address_map']['redis_mast...
# frozen-string-literal: true require File.join(File.dirname(__FILE__), 'helper') class TestID3v2Frames < Test::Unit::TestCase context "The sample.mp3 file's frames" do setup do read_properties = false # It's important that file is an instance variable, otherwise the # tag would get garbage co...
# -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure(2) do |config| config.vm.box = "ubuntu/xenial64" config.vm.define "pandas-drf-tools-test-vm" do |vm_define| end config.vm.hostname = "pandas-drf-tools-test.local" config.vm.network "forwarded_port", guest: 80, host: 8000 config.vm.network "forwa...
class PatientsController < ApplicationController include PatientHelper def index @patients = Patient.find(:all, :order => "id desc") end def show @patient = Patient.find(params[:id]) @message = params[:message] end def search patient_id = params[:patient_id] patient_name = params[:pati...
class CreateLocations < ActiveRecord::Migration def change create_table :locations do |t| t.decimal :center_lat t.decimal :center_long t.decimal :radius t.string :name t.timestamps end end end
FactoryGirl.define do factory :idea do sequence(:title) { |n| "#{Faker::Coffee.blend_name} #{n}" } description { Faker::Coffee.notes } end end
# frozen_string_literal: true require_relative '../lib/clioper.rb' describe CLIOperations, '#general_input_response' do context 'validation lambda checking for 1 or more digits' do validation_lambda = ->(str) { str =~ /\d+/ } prompt = 'Enter a number' invalid_input_msg = 'Invalid response. Please enter...
Rails.application.routes.draw do # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html root to: "pages#index" resources :accounting_codes resources :accounting_entries, only: [:index, :show] get "/reports/trial_balance", to: "reports#trial_balance", as: :report...
require 'test_helper' class RetailerProfilesControllerTest < ActionController::TestCase setup do @retailer_profile = retailer_profiles(:one) end test "should get index" do get :index assert_response :success assert_not_nil assigns(:retailer_profiles) end test "should get new" do get :ne...