This file contains 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 ApplicationController from './application'; | |
ApplicationController.reopen({ | |
unsetToken: Ember.observer('token', function() { | |
if (this.get('token')) { | |
Ember.run.next(this, function() { | |
this.set('token', null); | |
}); | |
} | |
}) |
This file contains 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
// app/routes/application.js | |
import Ember from 'ember'; | |
import ApplicationRouteMixin from 'ember-simple-auth/mixins/application-route-mixin'; | |
export default Ember.Route.extend(ApplicationRouteMixin, { | |
session: Ember.inject.service('session'), | |
isTokenAuthenticating: null, | |
model(params) { |
This file contains 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
// app/controllers/application.js | |
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
queryParams: ['token'], | |
token: null | |
}); |
This file contains 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
// app/authenticators/token.js | |
import OAuth2PasswordGrant from 'ember-simple-auth/authenticators/oauth2-password-grant'; | |
export default OAuth2PasswordGrant.extend({ | |
authenticate(token) { | |
return new Promise((resolve, reject) => { | |
resolve({ | |
access_token: token, | |
token_type: 'bearer' | |
}); | |
}); |
This file contains 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.Controller.extend({ | |
matchingStates: [], | |
states: Ember.inject.service('states'), | |
actions: { | |
updateMatches(query) { | |
if (Ember.isPresent(query)) { |
This file contains 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(Ember.PromiseProxyMixin, { | |
store: Ember.inject.service(), | |
query(limit, offset) { | |
return this.get('store').query('state', { | |
include: 'country,region', | |
page: { |
This file contains 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({ | |
states: Ember.inject.service('states'), | |
beforeModel() { | |
this.get('states'); | |
}, | |
}); |
This file contains 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
task :stats => "app:stats_setup" | |
# insert additional types into the statistics table and sort the list | |
namespace :app do | |
task :stats_setup do | |
require 'rails/code_statistics' | |
app_entries, spec_entries = [], [] | |
until ::STATS_DIRECTORIES.empty? | |
entry = STATS_DIRECTORIES.shift |
This file contains 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
Seans-MacBook-Pro:blackjack-rails-api seandevine$ bundle exec rspec --format documentation | |
Run options: include {:focus=>true} | |
All examples were filtered out; ignoring {:focus=>true} | |
Randomized with seed 31252 | |
V1::CardResource | |
has no updatable fields | |
has no creatable fields |
This file contains 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
// login.hbs | |
// {{input value=identification name='identification'}} | |
// {{input value=password name='password' enter='authenticate'}} | |
// <button name='login' {{action 'authenticate'}}>Login</button> | |
// this test passes | |
test('login with valid credentials', function(assert) { | |
visit('/login'); | |
andThen(function() { |