This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'rspec/autorun' | |
| require 'benchmark' | |
| describe "polish notation" do | |
| it "do a trivial case" do | |
| polish_parser(:+, 1, 1).first.should == 2 | |
| reverse_stack_polish_parser(:+, 1, 1).first.should == 2 | |
| pm_polish_parser(:+, 1, 1).first.should == 2 | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'test_helper' | |
| class MerchantAccountTest < ActiveSupport::TestCase | |
| setup do | |
| @merchant_account = FactoryGirl.create(:merchant_account) | |
| end | |
| should "fetch authorized orders" do | |
| @order = FactoryGirl.create(:order, venue: @merchant_account.venue) | |
| credit_card_hash = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class SpeakersController < ApplicationController | |
| load_and_authorize_resource :event | |
| load_and_authorize_resource :speaker, through: [:event], shallow: true #the array here could only be the single symbol but since i almost always wind up adding more, i just start with it | |
| before_filter :new_speaker, :only => [:new, :create] | |
| respond_to :html | |
| def index | |
| end | |
| def show |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| source 'https://rubygems.org' | |
| ruby "2.0.0" | |
| gem 'rails', github: 'rails/rails' | |
| gem 'arel', github: 'rails/arel' | |
| ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| App.Router.map(function() { | |
| this.resource('tables', function() { | |
| this.resource('table', {path: ':table_id'}); | |
| }); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $("#my_button_id").click(function () { | |
| call_my_other_js; | |
| });) | |
| $("#my_button_id").click(function () { | |
| $("form#formID").submit(); | |
| });) | |
| $("#my_button_id").click(function () { | |
| do_thing_3_for_kicks; | |
| });) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "xpath" # XPath is a separate gem now | |
| module Cucumber | |
| module Rails | |
| module CapybaraSelectDatesAndTimes | |
| def select_date (date, options = {}) | |
| date = Date.parse(date) | |
| # lookup id prefix by label | |
| id_prefix = id_prefix_for(options[:label]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class EquipmentItem | |
| attr_accessor :task_items, equipment_hauls | |
| def current_location | |
| last_task = task_items.sort_by{|a| a.end_time }.last | |
| last_haul = equipment_hauls.last | |
| if last_task && last_haul | |
| if last_task.end_time > last_haul.performed_at | |
| last_task.timesheet.job | |
| else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require_relative '../features_helper' | |
| describe "as an admin", js: true do | |
| it 'crawls the site with a tiny data set' do | |
| default_url_options[:host] = "127.0.0.1:6543" | |
| sign_in(:admin) | |
| objects = [ | |
| create(:customer), | |
| create(:job), | |
| create(:employee), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| it "can have the dig test requirement overridden" do | |
| job = create :job | |
| job.approve | |
| sign_in(:dispatcher) | |
| visit edit_job_path(job) | |
| find(:css, "#job_no_dig_test_needed").set(true) #selenium test errors on this line - it can't find the selector but in reality it didn't find the job | |
| click_button "Update" | |
| visit job_path(job) | |
| expect(page).to have_content "Activate" | |
| end |