Skip to content

Instantly share code, notes, and snippets.

this.resource('contract', {path: '/contract'}, function() {
this.route('edit', {path: ':contract_id/edit'});
this.route('show', {path: ':contract_id'});
});
Ember.RSVP.configure('onerror', function(e) {
console.log(e.message);
console.log(e.stack);
});
functionThatReturnsPromise.then(function() {
console.log('about to do some logic');
this.get('controllers.application.currentUser').reload();
console.log('Why won\'t my code get to this point????');
});
describe "mocked query of web service" do
it "should perform correct action on system data based on mocked response" do
RestClient = double
file = File.open('RELATIVE_FILE_PATH_HERE', 'r') #Relative to root of Rails app
data = file.read
file.close
response = double
response.stub(:code) { 200 }
response.stub(:body) { data }
App.get('currentPath');
App = Ember,Application.create({
currentPath: ''
});
ApplicationController : Ember.Controller.extend({
currentPathDidChange: function() {
App.set('currentPath', this.get('currentPath'));
}.observes('currentPath')
});
test("Check editing of a book updates search results", function() {
expect(7);
visit("/").then(function() {
return click("#searchButton"); //Click the search button
}).then(function() {
throws(
function() {
find(".searchResult h2:contains('The Great Modification')") ;
test("Check retrieval of books", function() {
expect(6);
visit("/").then(function() {
ok(exists(".navBar"), "The navbar was rendered");
ok(exists("#searchButton"), "SearchButton was found");
});
visit("/").then(function() {
return click("#searchButton");
//= require application
//= require_tree .
//= require_self
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>');
App.rootElement = '#ember-testing';
App.setupForTesting();
App.injectTestHelpers();
module("Ember.js Library", {
setup: function() {
Ember.run(App, App.advanceReadiness);
},
teardown: function() {
App.reset();
}
});
test("Check HTML is returned", function() {