Skip to content

Instantly share code, notes, and snippets.

View synth's full-sized avatar

Peter Philips synth

View GitHub Profile
@synth
synth / gist:3329212
Created August 12, 2012 02:42
weird rails association behavior
$> rails new mynewapp
$> cd mynewapp
$> rails g model User
$> rails g model Whatever
$> rake db:migration
#user.rb
belongs_to :whatever
$> rails c
@synth
synth / gist:3292441
Created August 8, 2012 05:29
Sometimes you need to slow down Capybara until certain things have loaded(like javascript assets loaded with RequireJS), here's a solution I came up with:
#/spec/support/asynchronous_helper.rb
module AsynchronousHelper
def wait_until_remote_events_are_bound
page.wait_until do
page.evaluate_script("typeof($assetsloaded) === 'object'")
end
end
def wait_until_overlay_has_popped_up