# Automated Ember tests in Rails environment

**URL:** <https://discuss.emberjs.com/t/automated-ember-tests-in-rails-environment/3380>\
**Category:** Testing\
**Created:** [November 18, 2013, 2:23pm UTC](https://discuss.emberjs.com/t/automated-ember-tests-in-rails-environment/3380 "2013-11-18T14:23:32Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![lukegalea](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/lukegalea/32/4306_2.png) [@lukegalea](https://discuss.emberjs.com/u/lukegalea)\
**Post date:** [December 16, 2013, 4:36pm UTC](https://discuss.emberjs.com/t/automated-ember-tests-in-rails-environment/3380/5 "2013-12-16T16:36:33Z")

</div>

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

```

---

_[View the full topic](https://discuss.emberjs.com/t/automated-ember-tests-in-rails-environment/3380)._
