Last active
August 29, 2015 14:21
-
-
Save chrism/9c072ddc53b43543d674 to your computer and use it in GitHub Desktop.
Simple service example
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
import Ember from 'ember'; | |
import { | |
module, | |
test | |
} from 'qunit'; | |
import startApp from 'ember-mock-services-example/tests/helpers/start-app'; | |
var application; | |
module('Acceptance: ExampleService', { | |
beforeEach: function() { | |
application = startApp(); | |
}, | |
afterEach: function() { | |
Ember.run(application, 'destroy'); | |
} | |
}); | |
test('uses real service', function(assert) { | |
visit('/'); | |
andThen(() => { | |
assert.ok(find(':contains("Real Service")').length, | |
'expected to see "Real Service"'); | |
}); | |
}); |
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
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
example: Ember.inject.service(), | |
model() { | |
return this.get('example').model(); | |
} | |
}); |
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
import Ember from 'ember'; | |
export default Ember.Service.extend({ | |
model() { | |
return 'Real Service'; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment