Skip to content

Instantly share code, notes, and snippets.

View mikegehard's full-sized avatar

Mike Gehard mikegehard

  • Chattanooga, TN
  • 05:01 (UTC -05:00)
View GitHub Profile
When /^I wait until "([^"]*)" is visible$/ do |selector|
page.has_css?("#{selector}", :visible => true)
end
@mikegehard
mikegehard / Rocket powered Cucumber features
Created August 20, 2010 15:25
Speeding up your selenium cucumber tests
Add this to the Gemfile and Cucumber takes care of the rest.
gem 'thin', :group => :test
@mikegehard
mikegehard / Stack trace for Cucumber features
Created September 16, 2010 12:47
Stack trace for failing Cucumber features in factory_girl_rails
[@1.9.2@factory_girl_rails ][msgehard@localhost:factory_girl_rails(master)]$ rake --trace
(in /Users/msgehard/Documents/Development/rubyDevelopment/gems_source/factory_girl_rails)
** Invoke default (first_time)
** Invoke cucumber (first_time)
** Execute cucumber
bundle exec /Users/msgehard/.rvm/rubies/ruby-1.9.2-p0/bin/ruby -I "/Users/msgehard/.rvm/gems/ruby-1.9.2-p0@factory_girl_rails/gems/cucumber-0.8.5/lib:lib" "/Users/msgehard/.rvm/gems/ruby-1.9.2-p0@factory_girl_rails/gems/cucumber-0.8.5/bin/cucumber" --format progress
Using the default profile...
$ /Users/msgehard/.rvm/rubies/ruby-1.9.2-p0/bin/ruby -S rails new test_app
@mikegehard
mikegehard / Links
Created September 16, 2010 14:34
Links list
@mikegehard
mikegehard / Webdriver
Created September 17, 2010 20:17
Using firebug with cucumber/webdriver
Use capybara-firebug
@mikegehard
mikegehard / gist:600110
Created September 27, 2010 23:48
List of interesting gems
VCR (recording and playing back web service calls)
http://github.com/myronmarston/vcr
Pusher (WebSockets made easy)
http://www.pusherapp.com/
http://www.rubyinside.com/pusher-websocket-service-3246.html
@mikegehard
mikegehard / Almond milk recipe
Created February 13, 2011 17:07
Almond Milk Recipe
Almond Milk Recipe from Rawsome! by Brigette Mars
1 cup almonds, soaked overnight, then rinsed
1 quart water
Honey (or anything else you care to add) to taste
Combine all ingredients in a blender and liquify.
Strain through a nut milk bag or sprout bag. I had a hard time finding either in Boulder (go figure) so I just used an old, clean pantyhose.
Store in the refrigerator. Lasts about a week.
@mikegehard
mikegehard / gist:853253
Created March 3, 2011 18:41
Testing OmniAuth login via cucumber...
Before('@omniauth_test') do
OmniAuth.config.test_mode = true
# the symbol passed to mock_auth is the same as the name of the provider set up in the initializer
OmniAuth.config.mock_auth[:google] = {
"provider"=>"google",
"uid"=>"http://xxxx.com/openid?id=118181138998978630963",
"user_info"=>{"email"=>"[email protected]", "first_name"=>"Test", "last_name"=>"User", "name"=>"Test User"}
}
end
@mikegehard
mikegehard / active_model_lint.rb
Created April 8, 2011 21:26 — forked from pairing/active_model_lint.rb
RSpec shared examples for ActiveModel::Lint
# adapted from rspec-rails http://github.com/rspec/rspec-rails/blob/master/spec/rspec/rails/mocks/mock_model_spec.rb
# put this in a file in your spec/support directory
# USAGE:
#
# let(:model) { ModelUnderTest.new(params) }
# it_behaves_like "ActiveModel"
shared_examples_for "ActiveModel" do
require 'test/unit/assertions'
require 'active_model/lint'
@mikegehard
mikegehard / Setting longer HTTP timeout in capybara
Created April 15, 2011 19:20
Setting longer HTTP timeout in capybara
# We need this to fix the random timeout error that we were seeing in CI.
# May be related to: http://code.google.com/p/selenium/issues/detail?id=1439
Capybara.register_driver :selenium_with_long_timeout do |app|
client = Selenium::WebDriver::Remote::Http::Default.new
client.timeout = 120
Capybara::Driver::Selenium.new(app, :browser => :firefox, :http_client => client)
end
Capybara.javascript_driver = :selenium_with_long_timeout