text
stringlengths
10
2.61M
require 'spec_helper' describe 'autofs' do context 'supported operating systems' do on_supported_os.each do |os, facts| context "on #{os}" do let(:facts) do facts.merge({ :concat_basedir => '/etc/puppet' }) end context "autofs class without any parameters" do ...
# -*- ruby -*- spec = Gem::Specification.new do |s| s.name = 'gnuplot' s.description = s.summary = "Utility library to aid in interacting with gnuplot" s.version = "2.2.3.1" s.platform = Gem::Platform::RUBY s.date = Time.new s.files = [ "lib/gnuplot.rb" ] s.autorequire = 'gnuplot.rb' s.author = "Gor...
class UpdateReferencesToContext < ActiveRecord::Migration[6.1] def change rename_column :arch_objects, :site_phase_id, :context_id end end
module VmScanItemNteventlog def to_xml xml = @xml_class.newNode('scan_item') xml.add_attributes('guid' => @params['guid'], 'name' => @params['name'], 'item_type' => @params['item_type']) d = scan_definition xml.root << d[:data] if d[:data] xml end def parse_data(vm, data, &_blk) if data.n...
require_relative 'api_spec_helper' module DiceOfDebt describe API do include_context 'api test' shared_examples :initial_game do subject { data } its([:id]) { should match '\d+' } its([:type]) { should eq 'game' } describe 'attributes' do subject { data[:attributes] } ...
require 'spec_helper' feature 'user adds an owner', %q{ As a real estate associate I want to record a building owner So that I can keep track of our relationships with owners } do # Acceptance Criteria: # I must specify a first name, last name, and email address # I can optionally specify a company name ...
require 'active_support/concern' module SmoochTurnio extend ActiveSupport::Concern module ClassMethods def get_turnio_installation(signature, data) self.get_installation do |i| secret = i.settings.with_indifferent_access['turnio_secret'].to_s unless secret.blank? Base64.encode6...
class Foerdermitglied < ActiveRecord::Base set_table_name "Foerdermitglied" attr_accessible :pnr, :region, :foerderbeitrag validates_presence_of :region, :foerderbeitrag end
module Pantograph module Actions class GitTagExistsAction < Action module SharedValues GIT_TAG_EXISTS ||= :GIT_TAG_EXISTS end def self.run(params) tag_exists = true Actions.sh( "git rev-parse -q --verify refs/tags/#{params[:tag].shellescape}", log: P...
require 'find' class Keg def fix_install_names mach_o_files.each do |file| bad_install_names_for file do |id, bad_names| file.ensure_writable do system MacOS.locate("install_name_tool"), "-id", id, file if file.dylib? bad_names.each do |bad_name| new_name = bad_name...
# frozen_string_literal: true module Ysera # A encoder class to encode any type of string data class Encoder def self.run(secretable) new(secretable).run end private def initialize(secretable) @secretable = secretable end def run; end end end
# frozen_string_literal: true class TestHomePage < SitePrism::Page set_url '/home.htm' set_url_matcher(/home\.htm$/) # individual elements element :welcome_header, :xpath, '//h1' element :welcome_message, 'body > span' element :go_button, '[value="Go!"]' element :link_to_search_page, :xpath, '//p[2]/a' ...
require 'rails_helper' describe 'An admin' do describe 'visiting the bike shop items' do before :each do @admin = create(:user, role: 1) @item = Item.create(title: 'bike lights', description: 'wonderful led', price: 10, image: 'https://www.elegantthemes.com/blog/wp-content/uploads/2015/02/custom-trac...
# Virus Predictor # I worked on this challenge [with: Kimberly ]. # We spent [#] hours on this challenge. # EXPLANATION OF require_relative # # #require_relative 'state_data' #require_relative is used for the relative path of the class file that you're pulling into your file. #require on the other hand uses a absolu...
require 'highline/import' require 'netrc' require 'acquia_toolbelt/cli' module AcquiaToolbelt class CLI class Auth < AcquiaToolbelt::Thor # Public: Login to an Acquia account. # # Save the login details in a netrc file for use for all authenticated # requests. # # Returns a st...
# # Cookbook Name:: impala # Recipe:: config # # Copyright © 2013-2015 Cask Data, 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 # # Un...
#!/usr/bin/env ruby class Image def initialize(id_matrices) @id_tiles = id_matrices.map do |id, matrix| [id, Tile.new(matrix)] end.to_h end def construct_image first_id = @id_tiles.keys.first @tilemap = [[first_id]] place_matching_tiles(first_id) end def corner_ids [ @t...
class Panel::MenuItemsController < Panel::BaseController before_action :set_menu before_action :set_menu_item, only: [:edit, :update, :destroy] before_action :authorize_menu_item respond_to :html def index @menu_items = @menu.menu_items.includes(:item_type).includes(:category) filter_by_category ...
module ApplicationHelper def login_helper if current_user.is_a?(GuestUser) link_to 'Register', new_user_registration_path link_to 'Login', new_user_session_path else link_to 'Logout', destroy_user_session_path, method: :delete end end def source_helper greeting = "Welcome. Thank...
require "application_system_test_case" class ShoppingListItemsTest < ApplicationSystemTestCase setup do @shopping_list_item = shopping_list_items(:one) end test "visiting the index" do visit shopping_list_items_url assert_selector "h1", text: "Shopping List Items" end test "creating a Shopping ...
class Api::UsersController < Api::ApplicationController before_action :auth_user, only: [:index, :update, :destroy, :following, :followers] before_action :correct_user, only: :update before_action :admin_user, only: :destroy def index @users = User.where(activated: true).paginate(page: params[:page]) end...
module VulnTemplates module Helpers private module Curl def headers(http_response) res = "" res += "HTTP/#{http_response.http_version} #{http_response.code} #{http_response.msg}\n" http_response.header.each_header do |key,value| res += "#{key.capitalize}: #{value}\n" ...
module BundlerOutdatedRequiredGems class Analyzer def find_outdated_required_gems say "getting outdated gems via 'bundle outdated' ..." bundler_outdated_gems = extract_outdated_gems(bundle_outdated) say "found #{bundler_outdated_gems.size} gems:\n#{formatted_gem_line(bundler_outdated_gems)}" i...
module RhodeIsland module ActiveRecordExtensions extend ActiveSupport::Concern included do end module ClassMethods def has_state_machine(states) send :include, InstanceMethods class_eval do states.each do |state| define_method :"is_#{state}?" do ...
require 'spec_helper' require 'app/workers/webhook_worker' describe WebhookWorker do %w[beer brewery event guild location].each do |klass| it "creates a #{klass} webhook given a set of params" do params = { 'type' => klass, 'action' => 'edit', 'attributeId' => 'fake', 'subAc...
// From es5 interface Node { type: string; loc: SourceLocation | null; } interface SourceLocation { source: string | null; start: Position; end: Position; } interface Position { line: number; // >= 1 column: number; // >= 0 } interface Identifier <: Expression, Pattern { type: "Ident...
FactoryBot.define do factory :address do zip_code { "12345"} factory :us_address do country { "United States" } state_province { CS.states(:us).values.sample} end factory :non_us_address do country { CS.countries.values.sample } state_province { Faker::Address.state } end ...
class Survivor include Mongoid::Document INFECTION_MAX = 3 # Survivor's fields field :name, type: String field :age, type: String field :gender, type: String field :last_location, type: Hash field :infection_count, type: Integer, default: 0 # Relationships has_many :resources accepts_nested_at...
# # Cookbook Name:: nginx # Recipe:: default # # Copyright 2016, YOUR_COMPANY_NAME # # All rights reserved - Do Not Redistribute # package "nginx" do action :install end web_servers = search(:node, 'role:"webserver"') template "/etc/nginx/nginx.conf" do source "nginx.conf.erb" mode "0644" notifies :restart, "se...
module Spree module Api module Serializable def meta_for(object) meta = {} if object.respond_to?('total_pages') meta[:count] = object.count meta[:total_count] = object.total_count meta[:current_page] = params[:page] ? params[:page].to_i : 1 meta[:per...
#!/usr/bin/env ruby class String #Test if a string is wholly number def numeric? return true if self =~ /^\d+$/ true if Float(self) rescue false end end class Table def initialize @top_edge = 4 @bottom_edge = 0 @left_edge = 0 @right_edge = 4 end #Is this a valid placement on the ...
require 'rails_helper' RSpec.describe 'Merchant add coupon' do describe 'as a merchant employee' do before :each do @merchant_1 = create :merchant @merchant_user = create :random_merchant_user, merchant: @merchant_1 @coupon = create :coupon, merchant: @merchant_1 allow_any_instance_of(App...
## # This module requires Metasploit: https://metasploit.com/download # Current source: https://github.com/rapid7/metasploit-framework ## class MetasploitModule < Msf::Exploit::Remote Rank = ExcellentRanking prepend Msf::Exploit::Remote::AutoCheck include Msf::Exploit::CmdStager include Msf::Exploit::FileDro...
class Store::CategoriesController < Store::StoreController def show @category = ProductCategory.find_by(slug: params[:slug]) @store_categories = ProductCategory.visible.active.sorted @products = @category.products.visible.active.sorted end end
require 'stemmer' class Classifier def initialize() @initialized = false @count_class = Hash.new @count_word = Hash.new @word_probabilities = Hash.new @class_probabilities = Hash.new @sum_of_words = 0 end def info puts "Classifier knows about #{@count_word.keys} categories and it...
class ApplicationRecord < ActiveRecord::Base self.abstract_class = true max_paginates_per 100 private def self.optional_param_scope(name = nil, value = nil) if value.present? where("#{name}" => value) end end def self.optional_date_scope(name = nil, value = nil) if value.pr...
require 'rails_helper' RSpec.describe Meaning, :type => :model do it { should have_many(:words) } end
require 'minitest/autorun' require "minitest/reporters" Minitest::Reporters.use! =begin Write a minitest assertion that will fail if the 'xyz' is not in the Array list. =end class IsStringInArray < Minitest::Test def setup @ary = ['abc', 'efg', 'xyz'] end def test_that_string_is_included_in_array ass...
module Cybersourcery class ReasonCodeChecker REASON_CODE_EXPLANATIONS = { '100' => 'Successful transaction.', '101' => 'Declined: The request is missing one or more required fields.', '102' => 'Declined: One or more fields in the request contains invalid data', '104' => 'Declined: An ident...
# frozen_string_literal: true class AddElevationGainToSpotsVtts < ActiveRecord::Migration[6.0] def change add_column :spots_vtts, :elevation_gain, :float end end
class AddOrganization < ActiveRecord::Migration[5.2] def change create_table :organizations do |t| t.string :title t.integer :organization_type_id t.string :inn t.string :ogrn end end end
module OWD class InventoryStatus < Document def _build opts = {} if opts[:filters] doc.tag!(self.owd_name) do opts[:filters].each do |filt| doc.tag!('FILTER') do filt.each do |key, value| doc.tag!(key.upcase, value) end en...
#!/usr/bin/env ruby require 'yaml' require 'octokit' require 'priha' include Priha config_file = if /mswin|msys|mingw|cygwin|bccwin|wince|emc/ =~ RUBY_PLATFORM File.join(ENV['USERPROFILE'], '.priha_config.yml') else File.join(ENV['HOME'], '.priha_config.yml') ...
require 'spec_helper' describe 'cube', :type => :class do context 'no parameters' do let(:facts) { {:operatingsystem => 'Debian'} } it { should contain_package('cube').with_provider('npm').with_ensure('latest')} it { should create_class('cube::config')} it { should create_class('cube::install')} ...
require 'spec_helper' describe User do describe "with minimal attributes" do subject do User.create \ :username => 'aap', :email => 'aap@example.com', :password => 'nootjes', :password_confirmation => 'nootjes' end specify { should have(:no).errors } specify { should be_reg...
class Tag < ActiveRecord::Base has_and_belongs_to_many :categories validates :name, uniqueness: true def to_param name end end
#Utilizes EntityMoving and provides #semi-realistic movement according to force #specified for Entity's using this module. #The force (ep_fx,ep_fy) corresponds to the #distance effectively passed over multiple frames. #To get a certain speed, add the desired value to #the force each frame, e.g.: #self.ep_fx += @runspee...
require 'sinatra/base' # You have the application scope binding inside: # Your application class body # Methods defined by extensions # The block passed to helpers # Procs/blocks used as value for set # The block passed to Sinatra.new # You can reach the scope object (the class) like this: # Via the object passed to ...
class K0300 attr_reader :options, :name, :field_type, :node def initialize @name = "Weight Loss - Loss of 5% or more in the last month or loss of 10% or more in the last 6 months. (K0300)" @field_type = DROPDOWN @node = "K0300" @options = [] @options << FieldOption.new("^", "NA") @options ...
require_relative('../db/sql_runner.rb') class Session attr_reader :name, :capacity, :id def initialize(options) @id = options['id'].to_i if options['id'] @name = options['name'] @capacity = options['capacity'].to_i end #CRUD def save sql = 'INSERT INTO sessions (name, capacity) VALUES ($1...
require 'rails_helper' feature "user likes a friend's post" do context "from the friend's profile" do before(:each) do @bob = FactoryBot.create(:user, name: "bob", email: "bob@example.com") @frank = FactoryBot.create(:user, name: "frank", email: "frank@example.com") @frank.friends << @bob ...
class UnitsController < ApplicationController before_action :authorize_admin before_action :set_unit, only: [:show, :edit, :update, :destroy] def index respond_to do |format| format.html format.json { render json: UnitDatatable.new(params) } end end def show end def new @unit =...
class Song attr_accessor :name, :artist, :genre @@all = [] def initialize(name, artist = nil, genre = nil) @name = name self.artist = artist self.genre = genre end def save @@all << self end def self.all @@all end def self.destroy_all ...
require 'rails_helper' RSpec.describe Block, type: :model do it { should have_valid(:name).when("A1") } it { should_not have_valid(:name).when(nil, "")} it { should have_valid(:color).when("green", "pink") } it { should_not have_valid(:color).when(nil, "")} it { should have_valid(:repetitions).when(1, 50) ...
class ApplicationController < ActionController::API def logged_in? !!current_user end def current_user # binding.pry if auth_present? user = User.find(auth["user"]) if user @current_user ||= user end end end def authenticate # render json: {error: "unauthorize...
class AddTeamIdToProjectMedias < ActiveRecord::Migration def change add_column :project_medias, :team_id, :integer add_index :project_medias, :team_id end end
class Sampling::ProgramOptinController < ApplicationController before_filter :load_program before_filter :require_authentication, :only => :optin before_filter :hide_branding_content, :only => [:index, :optin] ssl_required :index, :optin, :index_from_session_user caches_page :index, :success def ind...
class Company < ActiveRecord::Base has_friendly_id :unique_identifier, :use_slug => false belongs_to :account belongs_to :city belongs_to :maintainer, :class_name => 'User' has_many :employees has_many :users, :through => :employees has_many :pages, :as => :pageable validates :name, :presence => true,...
require_relative 'import_job' module Budget module PcFinancial class ImportService < Budget::ImportService preference :client_number preference :password define_singleton_method(:description) { 'PC Financial CSV Import Service' } def call(options) ImportJob.new( client...
class ProductsController < ApplicationController def index end def new @product = Product.new @supplier = @product.suppliers.build() end def create @product = Product.new(product_params) @supplier = @product.suppliers.build(supplier_params) # binding.pry if @product.save && @suppli...
require_relative 'test_helper' require 'robot_factory' describe RobotFactory do include TestHelper before do @robot_factory = RobotFactory.new [ "#|#|#|##", "---X----", "###||###" ] end describe "#load_layout" do it "should initialize north laser bank" do refute @robot_f...
require 'posix/spawn' module Oncotrunk class Syncer def initialize @profile = "oncotrunk" @unison_config_path = File.expand_path("~/.unison") if RUBY_PLATFORM.downcase.include?("darwin") @unison_config_path = File.expand_path("~/Library/Application Support/Unison") end end ...
class BlogsController < ApplicationController before_action except: [:index, :show] do if @current_user.nil? redirect_to sign_in_path, notice: "Please Sign In" end end def index @blogs = Blog.all.order(created_at: :desc) end def new @blog = Blog.new end def create @blog = Blog.new @blog.use...
#!/usr/bin/env ruby puts '--------------------------------------------------' puts 'Tag Hook called' puts 'This hook is called when there is a specific tag' env_vars = %w[ LOADRUNNER_REPO LOADRUNNER_OWNER LOADRUNNER_EVENT LOADRUNNER_BRANCH LOADRUNNER_REF LOADRUNNER_TAG LOADRUNNER_COMMIT ] env_vars.each do |var...
# coding: UTF-8 require 'telegram/bot' TOKEN = '476505256:AAGOniuN-bBc4_ULiP33JlUbYhOSaV0imH8' ANSWERS = [ # Positive "Yes", "Of course", "All right", "No doubts", # Neutral "I do not now yet", "I think yes", # Negative "No", "It is forbidden", "I do not allow", "Hope you`re kidding" ] Te...
class Wrapper def wrap(string, col_num) return nil if string.empty? if string.length > col_num return string.split(" ").join("\n") end string end end describe Wrapper do let(:wrapper) { Wrapper.new } context "given an empty string and 0 as arguments" do ...
class ClientTypesController < ApplicationController before_action :set_client_type, only: [:show, :update, :destroy] # GET /client_types # GET /client_types.json def index @client_types = ClientType.all render json: @client_types end # GET /client_types/1 # GET /client_types/1.json def show ...
require 'spec_helper' describe "/transactions/index.html.erb" do include TransactionsHelper before(:each) do view_as_user :maintainer assigns[:transactions] = [ stub_model(Transaction, :title => "value for title", :name => "value for name", :definition => mock_definitio...
module Analyst module Entities class Hash < Entity handles_node :hash def pairs @pairs ||= process_nodes(ast.children) end # Convenience method to turn this Entity into an actual ::Hash. # If `extract_values` is true, then all keys and values that respond # to `#val...
# frozen_string_literal: true require 'parseline' module Brcobranca module Retorno module Cnab240 class Ailos < Brcobranca::Retorno::Cnab240::Base # Regex para remoção de headers e trailers além de registros diferentes de T ou U REGEX_DE_EXCLUSAO_DE_REGISTROS_NAO_T_OU_U = /^((?!^.{7}3.{5}[...
class BlacklistedTags < ActiveRecord::Migration def self.up create_table :blacklisted_tags do |t| t.column :kind, :enum, :limit => AbstractTag::KIND_ENUM_VALUES, :default => :about_me, :null => false t.column :value, :string, :limit => AbstractTag::VALUE_MAX_LENGTH, :null => false end end ...
class Appointment < Event # before_save :set_appointment_end_time validates_presence_of :user_id, :service_id, :company_id, :location_id validates_numericality_of :price, min: 0, step: :any def self.save_with_client(company, params) # save client first client_params = params[:appointment].delete(:cli...
#-- # $Id$ # #Copyright (C) 2007 David Dent # #This program is free software; you can redistribute it and/or #modify it under the terms of the GNU General Public License #as published by the Free Software Foundation; either version 2 #of the License, or (at your option) any later version. # #This program is distributed...
class PoliticalMandate < ApplicationRecord scope :search, ->(query) { where('description like ?', "%#{query}%") } validates :first_period, :description, :final_period, presence: true has_many :councilmen, dependent: :destroy validate :date_period def date_period errors.add(:first_period, I18n.t('error...
class CharacterAttributesController < ApplicationController before_action :get_character before_action :set_character_attribute, only: [:show, :edit, :update, :destroy] before_action :require_permission, only: [:destroy, :edit, :update] before_action :authenticate!, only: [:new, :create, :edit, :update, :d...
# комментарии к статьям в блоге class CommentsController < ApplicationController before_filter :authenticate_user! # реализовано только создание комментариев # вывод комментариев происходит в виде вывода статьи def create @article=Article.find(params[:article_id]) @article.comments.create(comment_params) r...
module Darky class Parser class << self def parse command, *args, &block String(command).split('___').join(' ') .split('__').join(' --') .split('_').join(' -') end end end end
class RentalsController < ApplicationController def index @rentals = Rental.all end def new @rental = Rental.new end def create #render text: params[:rental].inspect @rental = Rental.new(rental_params) @rental.save redirect_to @rental end def show @rental =...
class Country < ActiveRecord::Base has_many :user_countries has_many :users, through: :user_countries validates :name, presence: true, uniqueness: { case_sensitive: false } def self.create_from_api_data(data) country = self.create country.name = data["name"] country.topLevel...
require 'test_helper' class IcdBlocksControllerTest < ActionController::TestCase setup do @icd_block = icd_blocks(:one) end test "should get index" do get :index assert_response :success assert_not_nil assigns(:icd_blocks) end test "should get new" do get :new assert_response :succe...
FactoryGirl.define do factory :tagged do micropost { build(:micropost) } synonymous_club { build(:synonymous_club) } end factory :invalid_tagged, parent: :tagged do micropost nil synonymous_club nil end end
# frozen_string_literal: true module Renalware module Diaverum module Incoming class ReportMailer < ApplicationMailer # Send the report summary output from the diavereum:ingest rake task to interested # parties def import_summary(to:, summary_file_path:) to ||= config.diav...
module Parser # Is included by {CodeObject::Base} and {Parser::Comment} and stores Metainformation like # # - **filepath** of the JavaScript-File, where the comment is extracted from # - **source** of the JavaScript-Scope, which begins just after the comment ends. # - **line_start** - Linenumber of the first...
class AddSurveyScoreType < ActiveRecord::Migration[7.0] def change add_column :surveys, :score_type, :integer, default: 0 change_column_default :survey_questions, :format, from: nil, to: 0 end end
#!/usr/bin/env ruby require_relative 'jump_consistent_hash' require 'securerandom' KEYS = 10000 start_key = (ARGV[0] || SecureRandom.random_number(1 << 60)).to_i puts "start_key #{start_key}" stop_key = start_key + KEYS - 1 keys = (start_key..stop_key).to_a assigns = Array.new(KEYS, 0) dev_ratio_max = 0 move_ratio...
require 'spec_helper' describe 'php::fpm', type: :class do on_supported_os.each do |os, facts| context "on #{os}" do let :facts do facts end describe 'when called with no parameters' do case facts[:osfamily] when 'Debian' let(:params) do { ...
class Turn attr_reader :player, :dealer def initialize(player, dealer) @player = player @dealer = dealer @hand = [] end def over? false end def winner? if dealer.hand_value > 21 true elsif player.hand_value == 21 true elsif player.hand_value > dealer.hand_value ...
begin require 'rubygems' require 'jeweler' Jeweler::Tasks.new do |gemspec| gemspec.name = "yahoo_sports" gemspec.summary = "Ruby library for parsing stats from Yahoo! Sports pages" gemspec.description = "Ruby library for parsing stats from Yahoo! Sports pages. Currently supports MLB, NBA, NFL ...
class AddPosition2ToMovables < ActiveRecord::Migration def change add_column :movables, :position_2, :float, default: 0 end end
module CompaniesHouseXmlgateway module Service class CorporatePscCessation < CompaniesHouseXmlgateway::Service::Form API_CLASS_NAME = 'PSCCessation' SCHEMA_XSD = 'http://xmlgw.companieshouse.gov.uk/v1-0/schema/forms/PSCCessation-v1-1.xsd' # Generate the XML document that is embedded in th...
# encoding: utf-8 require "spec_helper" require "logstash/patterns/core" describe "NAGIOSLOGLINE - CURRENT HOST STATE" do let(:value) { "[1427925600] CURRENT HOST STATE: nagioshost;UP;HARD;1;PING OK - Packet loss = 0%, RTA = 2.24 ms" } let(:grok) { grok_match(subject, value) } it "a pattern pass the grok ...
# 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...
# frozen_string_literal: true class CreateHouses < ActiveRecord::Migration[6.1] def change create_table :houses do |t| t.integer :category, null: false t.integer :size, null: false t.integer :rooms, null: false t.integer :bathrooms, null: false t.integer :price, null: false t....
class Ability include CanCan::Ability def initialize(user, controller_namespace) user ||= User.new case controller_namespace when 'Admin' can :manage, :all if user.admin? else can :read, :all can :update, User,id: user.id end end end
require "lib/fraction.rb" describe Fraction do before :each do @f1 = Fraction.new(1,4) @f2 = Fraction.new(4,6) @f3 = Fraction.new(4,7) end describe "#Almacenamiento del numerador y denominador: " do it "Almacenamiento ok del numerador" do @f1.num.should eq(1) end it "Almacenamiento...
require 'spec_helper' module BakerServer describe Issue do it "fails validation with no issue_id" do Issue.new.should have(1).error_on(:issue_id) end it "fails validation with no summary" do Issue.new.should have(1).error_on(:summary) end it "fails validation with no published date...
class ProgramsController < ApplicationController before_filter :set_subnav def index mixpanel.track '[visits] Course Index' end def level_one @level = 'Beginner' @bootcamps = Bootcamp.beginner.published.by_date set_reviews(1) mixpanel.track '[visits] Course Page', level: @level end de...
class AddApiEchoedToInstances < ActiveRecord::Migration def change add_column :instances, :api_echoed, :integer, default: 0 end end
class ApplicationService < PutitService def add_application(payload) app = Application.find_or_create_by!(name: payload[:name]) if payload[:version] app.versions.find_or_create_by!(version: payload[:version]) end logger.info( "Application #{payload[:name]} with #{payload[:version]} added...
require 'spec_helper' require 'open3' require 'yaml' EXE_PATH = File.expand_path('../../exe/quaker', __FILE__) FIXTURES_PATH = File.expand_path('../fixtures', __FILE__) def exec args cmd = "cd #{FIXTURES_PATH} && bundle exec #{EXE_PATH} #{args}" stdin, stdout, stderr = Open3.popen3(cmd) stdout_content = stdout....