Automated Ember tests in Rails environment

We’ve refined our approach a little recently because all the “patiently/using_wait_time” stuff was causing us some trouble. Here’s the new version:

patiently do
  return unless page.has_css? '.ember-application'
end

2000.times do #this means up to 20 seconds
  return if page.evaluate_script "(typeof Ember === 'object') && !Ember.run.hasScheduledTimers() && !Ember.run.currentRunLoop"
  sleep 0.01
end