Skip to content

Instantly share code, notes, and snippets.

@pseudomuto
Created August 25, 2013 15:56
Show Gist options
  • Save pseudomuto/6334645 to your computer and use it in GitHub Desktop.
Save pseudomuto/6334645 to your computer and use it in GitHub Desktop.
Blog Code: Testing EmberJS Apps with Rails and QUnit
# in conf/application.rb
config.ember.variant = :development
# in conf/environments/production.rb
config.ember.variant = :production
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container-fluid">
<div class="brand">My Application</div>
<div class="btn-group pull-right">
Some stuff here
</div>
</div>
</div>
</div>
<div class="container-fluid" id="main">
<div class="row-fluid">
{{outlet}}
</div>
</div>
module "EmberJS Application Template",
setup: ->
EmberApp.reset()
test "default template", ->
visit("/").then ->
ok exists("*"), "Found Some HTML"
group :assets do
...
gem "handlebars-source"
gem 'ember-rails'
gem 'ember-source', '1.0.0.rc6.3'
gem 'qunit-rails'
...
end
rails new ember_app -T
cd ember_app
bundle install
rails g ember:boostrap
rails g ember:install --head
rails g qunit:install -c
...
...
document.write '<div id="ember-testing-container"><div id="ember-testing"></div></div>'
document.write '<style>#ember-testing-container { position: absolute; background: white; bottom: 0; right: 0; width: 640px; height: 384px; overflow: auto; z-index: 9999; border: 1px solid #ccc; } #ember-testing { zoom: 50%; }</style>'
# the name of your Ember App (check your `app/assets/javascripts` directory)
EmberApp.rootElement = '#ember-testing'
EmberApp.setupForTesting()
EmberApp.injectTestHelpers()
# a litte helper for finding elements
(exports ? this).exists = (selector) ->
return !!find(selector).length
@mockdeep
Copy link

Typo: ember:boostrap should be ember:bootstrap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment