Created
August 25, 2013 15:56
-
-
Save pseudomuto/6334645 to your computer and use it in GitHub Desktop.
Blog Code: Testing EmberJS Apps with Rails and QUnit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# in conf/application.rb | |
config.ember.variant = :development | |
# in conf/environments/production.rb | |
config.ember.variant = :production |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module "EmberJS Application Template", | |
setup: -> | |
EmberApp.reset() | |
test "default template", -> | |
visit("/").then -> | |
ok exists("*"), "Found Some HTML" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
group :assets do | |
... | |
gem "handlebars-source" | |
gem 'ember-rails' | |
gem 'ember-source', '1.0.0.rc6.3' | |
gem 'qunit-rails' | |
... | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rails new ember_app -T | |
cd ember_app |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bundle install | |
rails g ember:boostrap | |
rails g ember:install --head | |
rails g qunit:install -c |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
... | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Typo:
ember:boostrap
should beember:bootstrap
.