-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from amiel/acceptance-testing
Set up some acceptance testing
- Loading branch information
Showing
23 changed files
with
789 additions
and
131 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
module.exports = { | ||
globals: { | ||
server: true, | ||
}, | ||
root: true, | ||
parserOptions: { | ||
ecmaVersion: 2017, | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
module.exports = { | ||
globals: { | ||
server: true, | ||
}, | ||
env: { | ||
embertest: true | ||
} | ||
|
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { test } from 'qunit'; | ||
import moduleForAcceptance from '../../tests/helpers/module-for-acceptance'; | ||
|
||
moduleForAcceptance('Acceptance | basic url template test'); | ||
|
||
test('visiting /posts', function(assert) { | ||
server.createList('post', 5); | ||
|
||
visit('/posts'); | ||
|
||
andThen(() => { | ||
assert.equal(find('#posts .post').length, '5'); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import DS from "ember-data"; | ||
import UrlTemplates from "ember-data-url-templates"; | ||
|
||
export default DS.JSONAPIAdapter.extend(UrlTemplates); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
import DS from "ember-data"; | ||
import UrlTemplates from "ember-data-url-templates"; | ||
import ApplicationAdapter from './application'; | ||
|
||
export default DS.RESTAdapter.extend(UrlTemplates, { | ||
urlTemplate: "{+host}{/namespace}/my-post{/id}", | ||
namespace: 'api' | ||
export default ApplicationAdapter.extend({ | ||
urlTemplate: "{+host}{/namespace}/my-posts{/id}", | ||
namespace: 'api', | ||
}); |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import comment from 'ember-data-url-templates/models/comment'; | ||
import DS from 'ember-data'; | ||
|
||
export default comment; | ||
export default DS.Model.extend({ | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
import post from 'dummy/models/post'; | ||
import DS from 'ember-data'; | ||
|
||
export default post; | ||
const { attr } = DS; | ||
|
||
export default DS.Model.extend({ | ||
title: attr('string'), | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ const Router = Ember.Router.extend({ | |
}); | ||
|
||
Router.map(function() { | ||
this.route('posts'); | ||
}); | ||
|
||
export default Router; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,4 @@ | ||
import Ember from "ember"; | ||
|
||
export default Ember.Route.extend({ | ||
model: function() { | ||
return this.store.find('post'); | ||
} | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import Ember from 'ember'; | ||
|
||
export default Ember.Route.extend({ | ||
model() { | ||
return this.store.findAll('post'); | ||
}, | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
{{!-- The following component displays Ember's default welcome message. --}} | ||
{{welcome-page}} | ||
{{!-- Feel free to remove this! --}} | ||
|
||
{{outlet}} | ||
{{outlet}} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<h1>Posts</h1> | ||
|
||
<div id="posts"> | ||
{{#each model as |post|}} | ||
<div id="post-{{post.id}}" class="post"> | ||
{{post.title}} | ||
</div> | ||
{{/each}} | ||
</div> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
export default function() { | ||
|
||
this.get('/api/my-posts', 'post'); | ||
|
||
// These comments are here to help you get started. Feel free to delete them. | ||
|
||
/* | ||
Config (with defaults). | ||
Note: these only affect routes defined *after* them! | ||
*/ | ||
|
||
// this.urlPrefix = ''; // make this `http://localhost:8080`, for example, if your API is on a different server | ||
// this.namespace = ''; // make this `/api`, for example, if your API is namespaced | ||
// this.timing = 400; // delay for each request, automatically set to 0 during testing | ||
|
||
/* | ||
Shorthand cheatsheet: | ||
this.get('/posts'); | ||
this.post('/posts'); | ||
this.get('/posts/:id'); | ||
this.put('/posts/:id'); // or this.patch | ||
this.del('/posts/:id'); | ||
http://www.ember-cli-mirage.com/docs/v0.3.x/shorthands/ | ||
*/ | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { Factory, faker } from 'ember-cli-mirage'; | ||
|
||
export default Factory.extend({ | ||
title(i) { | ||
return `Post #${i}: ${faker.lorem.words()}`; | ||
}, | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { Model } from 'ember-cli-mirage'; | ||
|
||
export default Model.extend({ | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export default function(/* server */) { | ||
|
||
/* | ||
Seed your development database using your factories. | ||
This data will not be loaded in your tests. | ||
Make sure to define a factory for each model you want to create. | ||
*/ | ||
|
||
// server.createList('post', 10); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { JSONAPISerializer } from 'ember-cli-mirage'; | ||
|
||
export default JSONAPISerializer.extend({ | ||
}); |
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
Oops, something went wrong.