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
| > irb | |
| 1.9.3p0 :001 > a | |
| NameError: undefined local variable or method `a' for main:Object | |
| from (irb):1 | |
| from /Users/dnagir/.rvm/rubies/ruby-1.9.3-p0/bin/irb:16:in `<main>' | |
| 1.9.3p0 :002 > b | |
| NameError: undefined local variable or method `b' for main:Object | |
| from (irb):2 | |
| from /Users/dnagir/.rvm/rubies/ruby-1.9.3-p0/bin/irb:16:in `<main>' | |
| 1.9.3p0 :003 > a = b |
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
| # Controller spec using plain old matchers | |
| describe "#create" do | |
| let(:participation) { stub 'Participation' } | |
| let(:params) { {:participation => {}} } | |
| before { InviteUser.stub(:into_company_by_params => participation) } | |
| context "with success" do | |
| before { participation.stub(:valid? => true) } |
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
| ENV["RAILS_ENV"] ||= 'test' | |
| cur_dir = File.expand_path(File.dirname(__FILE__) + '/..') | |
| $LOAD_PATH << "#{cur_dir}" | |
| if defined? Bundler | |
| # Most likely going with the full env | |
| require 'spec_helper' | |
| else | |
| $LOAD_PATH << "#{cur_dir}/app/models" |
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
| # lib/tasks/ci.rake | |
| require 'nokogiri' | |
| desc "Run everything on the CI server with all its outcomes (deploy etc)" | |
| task :ci do | |
| Rake::Task['spec'].invoke | |
| ensure_test_coverage 99 | |
| Rake::Task['cucumber'].invoke | |
| # TODO: Figure out how to run Jasminerice https://github.com/bradphelan/jasminerice/issues/31 |
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 'capybara/util/timeout' | |
| # Rewriting the https://github.com/jnicklas/capybara/blob/master/lib/capybara/util/timeout.rb | |
| # Instead of raising timeout error, print the response info | |
| module Capybara | |
| class << self | |
| ## | |
| # Provides timeout similar to standard library Timeout, but avoids threads |
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 'rubygems' | |
| require 'nokogiri' | |
| require 'fileutils' | |
| require 'date' | |
| require 'uri' | |
| # usage: ruby import.rb my-blog.xml | |
| # my-blog.xml is a file from Settings -> Basic -> Export in blogger. | |
| data = File.read ARGV[0] |
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
| module HasSymbolicField | |
| extend ActiveSupport::Concern | |
| module ClassMethods | |
| # Defining (all below are equivalent): | |
| # - has_symbolic_field :status, [:active, :pending] | |
| # - has_symbolic_field :status, :active => 'Active', :pending => 'Pending' | |
| # - has_symbolic_field :status, :active => 'Active', :pending => nil | |
| # Accessing: | |
| # - it.status # :available |
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
| # lib/async_smtp_delivery_method.rb | |
| require 'mail' | |
| class AsyncSmtpDeliveryMethod | |
| def initialize(settings) | |
| @settings = settings | |
| end | |
| def deliver!(mail) |
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 File.expand_path('../boot', __FILE__) | |
| # Pick the frameworks you want: | |
| require "active_record/railtie" | |
| require "action_controller/railtie" | |
| require "action_mailer/railtie" | |
| require "active_resource/railtie" | |
| require "sprockets/railtie" | |
| # require "rails/test_unit/railtie" |
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
| module UtilitySteps | |
| def wait_for_page_load | |
| page.wait_until do | |
| if Capybara.current_driver != :rack_test | |
| page.has_css?('body.dom-loaded') and !has_pending_ajax_request? | |
| else | |
| true | |
| end | |
| end |