-
-
Notifications
You must be signed in to change notification settings - Fork 87
Write a routing acceptance test #85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
joostdevries
merged 6 commits into
ember-cli:master
from
Gaurav0:routing_acceptance_test
Jul 28, 2015
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
23de7c9
Try to write a routing acceptance test
Gaurav0 8cc3cb0
Fix acceptance test
Gaurav0 96e3154
Cleanup
Gaurav0 8d4ebd0
Merge branch 'master' into routing_acceptance_test
Gaurav0 1dddd40
Create gist-file factory; Refactor routing test
Gaurav0 4fc94ec
Replace computed with environment for host
Gaurav0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| { | ||
| "predef": [ | ||
| "server", | ||
| "document", | ||
| "window", | ||
| "-Promise", | ||
|
|
||
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| export default function() {} | ||
|
|
||
| /* | ||
| * Only loaded during tests | ||
| */ | ||
| export function testConfig() { | ||
|
|
||
| this.get('/gists/:id', function(db, request) { | ||
| let id = request.params.id; | ||
| return db.gists.find(id); | ||
| }); | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| /** | ||
| * This is a factory definition for a gist file | ||
| */ | ||
| import Mirage/*, {faker} */ from 'ember-cli-mirage'; | ||
|
|
||
| export default Mirage.Factory.extend({ | ||
| type() { | ||
| let extension = this.filename.substring(this.filename.lastIndexOf("."), this.filename.length); | ||
| switch (extension) { | ||
| case ".hbs": | ||
| return "text/plain"; | ||
| case ".css": | ||
| return "text/css"; | ||
| case ".js": | ||
| return "application/javascript"; | ||
| case ".json": | ||
| return "application/json"; | ||
| } | ||
| }, | ||
| language() { | ||
| let extension = this.filename.substring(this.filename.lastIndexOf("."), this.filename.length); | ||
| switch (extension) { | ||
| case ".hbs": | ||
| return "Handlebars"; | ||
| case ".css": | ||
| return "CSS"; | ||
| case ".js": | ||
| return "JavaScript"; | ||
| case ".json": | ||
| return "JSON"; | ||
| } | ||
| }, | ||
| raw_url() { | ||
| return `https://gist.githubusercontent.com/${this.login}/${this.gist_id}/raw/${this.commit}/${this.filename}`; | ||
| }, | ||
| size() { | ||
| return this.content.length; | ||
| }, | ||
| truncated: false | ||
| }); | ||
|
|
||
| /* Sample | ||
|
|
||
| "about.template.hbs": { | ||
| "filename": "about.template.hbs", | ||
| "type": "text/plain", | ||
| "language": "Handlebars", | ||
| "raw_url": "https://gist.githubusercontent.com/Gaurav0/35de43cb81fc35ddffb2/raw/b7332edd46bd97973c1dfebf495908b8abb9b301/about.template.hbs", | ||
| "size": 17, | ||
| "truncated": false, | ||
| "content": "<p>About Page</p>" | ||
| }, | ||
| */ |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,218 @@ | ||
| /** | ||
| * This is a factory definition for a gist. | ||
| */ | ||
| import Mirage/*, {faker} */ from 'ember-cli-mirage'; | ||
|
|
||
| export default Mirage.Factory.extend({ | ||
| url() { | ||
| return "https://api.github.com/gists/" + this.id; | ||
| }, | ||
| forks_url() { | ||
| return `https://api.github.com/gists/${this.id}/forks`; | ||
| }, | ||
| commits_url() { | ||
| return `https://api.github.com/gists/${this.id}/commits`; | ||
| }, | ||
| git_pull_url() { | ||
| return `https://gist.github.com/${this.id}.git`; | ||
| }, | ||
| git_push_url() { | ||
| return `https://gist.github.com/${this.id}.git`; | ||
| }, | ||
| html_url() { | ||
| return "https://gist.github.com/" + this.id; | ||
| }, | ||
| //files, | ||
| public: true, | ||
| created_at: "2015-07-23T22:30:30Z", | ||
| updated_at: "2015-07-23T22:49:45Z", | ||
| description: "New Twiddle", | ||
| comments: 0, | ||
| user: null, | ||
| comments_url() { | ||
| return `https://api.github.com/gists/${this.id}/comments`; | ||
| }, | ||
| //owner, | ||
| forks: [], | ||
| history: [] | ||
| }); | ||
|
|
||
| /* Sample | ||
| { | ||
| "url": "https://api.github.com/gists/35de43cb81fc35ddffb2", | ||
| "forks_url": "https://api.github.com/gists/35de43cb81fc35ddffb2/forks", | ||
| "commits_url": "https://api.github.com/gists/35de43cb81fc35ddffb2/commits", | ||
| "id": "35de43cb81fc35ddffb2", | ||
| "git_pull_url": "https://gist.github.com/35de43cb81fc35ddffb2.git", | ||
| "git_push_url": "https://gist.github.com/35de43cb81fc35ddffb2.git", | ||
| "html_url": "https://gist.github.com/35de43cb81fc35ddffb2", | ||
| "files": { | ||
| "about.template.hbs": { | ||
| "filename": "about.template.hbs", | ||
| "type": "text/plain", | ||
| "language": "Handlebars", | ||
| "raw_url": "https://gist.githubusercontent.com/Gaurav0/35de43cb81fc35ddffb2/raw/b7332edd46bd97973c1dfebf495908b8abb9b301/about.template.hbs", | ||
| "size": 17, | ||
| "truncated": false, | ||
| "content": "<p>About Page</p>" | ||
| }, | ||
| "application.template.hbs": { | ||
| "filename": "application.template.hbs", | ||
| "type": "text/plain", | ||
| "language": "Handlebars", | ||
| "raw_url": "https://gist.githubusercontent.com/Gaurav0/35de43cb81fc35ddffb2/raw/f354c6698b02fe3243656c8dc5aa0303cc7ae81c/application.template.hbs", | ||
| "size": 87, | ||
| "truncated": false, | ||
| "content": "{{#link-to \"index\"}}Index{{/link-to}}\n{{#link-to \"about\"}}About{{/link-to}}\n\n{{outlet}}" | ||
| }, | ||
| "index.template.hbs": { | ||
| "filename": "index.template.hbs", | ||
| "type": "text/plain", | ||
| "language": "Handlebars", | ||
| "raw_url": "https://gist.githubusercontent.com/Gaurav0/35de43cb81fc35ddffb2/raw/60a449a6591c3bd2ba7389354146c264b13c3166/index.template.hbs", | ||
| "size": 16, | ||
| "truncated": false, | ||
| "content": "<p>Main Page</p>" | ||
| }, | ||
| "router.js": { | ||
| "filename": "router.js", | ||
| "type": "application/javascript", | ||
| "language": "JavaScript", | ||
| "raw_url": "https://gist.githubusercontent.com/Gaurav0/35de43cb81fc35ddffb2/raw/0ef881458f8154407d50509be3598b31392d8153/router.js", | ||
| "size": 218, | ||
| "truncated": false, | ||
| "content": "import Ember from 'ember';\nimport config from './config/environment';\n\nvar Router = Ember.Router.extend({\n location: config.locationType\n});\n\nRouter.map(function() {\n this.route(\"about\");\n});\n\nexport default Router;\n" | ||
| }, | ||
| "twiddle.json": { | ||
| "filename": "twiddle.json", | ||
| "type": "application/json", | ||
| "language": "JSON", | ||
| "raw_url": "https://gist.githubusercontent.com/Gaurav0/35de43cb81fc35ddffb2/raw/8b44c317f1c80721a3a74f542ca0c55a01a5badf/twiddle.json", | ||
| "size": 303, | ||
| "truncated": false, | ||
| "content": "{\n \"version\": \"0.4.0\",\n \"dependencies\": {\n \"jquery\": \"https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js\",\n \"ember\": \"https://cdnjs.cloudflare.com/ajax/libs/ember.js/1.13.5/ember.js\",\n \"ember-data\": \"https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/1.13.5/ember-data.js\"\n }\n}" | ||
| } | ||
| }, | ||
| "public": true, | ||
| "created_at": "2015-07-23T22:30:30Z", | ||
| "updated_at": "2015-07-23T22:49:45Z", | ||
| "description": "New Twiddle", | ||
| "comments": 0, | ||
| "user": null, | ||
| "comments_url": "https://api.github.com/gists/35de43cb81fc35ddffb2/comments", | ||
| "owner": { | ||
| "login": "Gaurav0", | ||
| "id": 313960, | ||
| "avatar_url": "https://avatars.githubusercontent.com/u/313960?v=3", | ||
| "gravatar_id": "", | ||
| "url": "https://api.github.com/users/Gaurav0", | ||
| "html_url": "https://github.com/Gaurav0", | ||
| "followers_url": "https://api.github.com/users/Gaurav0/followers", | ||
| "following_url": "https://api.github.com/users/Gaurav0/following{/other_user}", | ||
| "gists_url": "https://api.github.com/users/Gaurav0/gists{/gist_id}", | ||
| "starred_url": "https://api.github.com/users/Gaurav0/starred{/owner}{/repo}", | ||
| "subscriptions_url": "https://api.github.com/users/Gaurav0/subscriptions", | ||
| "organizations_url": "https://api.github.com/users/Gaurav0/orgs", | ||
| "repos_url": "https://api.github.com/users/Gaurav0/repos", | ||
| "events_url": "https://api.github.com/users/Gaurav0/events{/privacy}", | ||
| "received_events_url": "https://api.github.com/users/Gaurav0/received_events", | ||
| "type": "User", | ||
| "site_admin": false | ||
| }, | ||
| "forks": [ | ||
|
|
||
| ], | ||
| "history": [ | ||
| { | ||
| "user": { | ||
| "login": "Gaurav0", | ||
| "id": 313960, | ||
| "avatar_url": "https://avatars.githubusercontent.com/u/313960?v=3", | ||
| "gravatar_id": "", | ||
| "url": "https://api.github.com/users/Gaurav0", | ||
| "html_url": "https://github.com/Gaurav0", | ||
| "followers_url": "https://api.github.com/users/Gaurav0/followers", | ||
| "following_url": "https://api.github.com/users/Gaurav0/following{/other_user}", | ||
| "gists_url": "https://api.github.com/users/Gaurav0/gists{/gist_id}", | ||
| "starred_url": "https://api.github.com/users/Gaurav0/starred{/owner}{/repo}", | ||
| "subscriptions_url": "https://api.github.com/users/Gaurav0/subscriptions", | ||
| "organizations_url": "https://api.github.com/users/Gaurav0/orgs", | ||
| "repos_url": "https://api.github.com/users/Gaurav0/repos", | ||
| "events_url": "https://api.github.com/users/Gaurav0/events{/privacy}", | ||
| "received_events_url": "https://api.github.com/users/Gaurav0/received_events", | ||
| "type": "User", | ||
| "site_admin": false | ||
| }, | ||
| "version": "921e8958fe32b5a1b724fa6754d0dd904cfa9e62", | ||
| "committed_at": "2015-07-23T22:49:45Z", | ||
| "change_status": { | ||
| "total": 1, | ||
| "additions": 1, | ||
| "deletions": 0 | ||
| }, | ||
| "url": "https://api.github.com/gists/35de43cb81fc35ddffb2/921e8958fe32b5a1b724fa6754d0dd904cfa9e62" | ||
| }, | ||
| { | ||
| "user": { | ||
| "login": "Gaurav0", | ||
| "id": 313960, | ||
| "avatar_url": "https://avatars.githubusercontent.com/u/313960?v=3", | ||
| "gravatar_id": "", | ||
| "url": "https://api.github.com/users/Gaurav0", | ||
| "html_url": "https://github.com/Gaurav0", | ||
| "followers_url": "https://api.github.com/users/Gaurav0/followers", | ||
| "following_url": "https://api.github.com/users/Gaurav0/following{/other_user}", | ||
| "gists_url": "https://api.github.com/users/Gaurav0/gists{/gist_id}", | ||
| "starred_url": "https://api.github.com/users/Gaurav0/starred{/owner}{/repo}", | ||
| "subscriptions_url": "https://api.github.com/users/Gaurav0/subscriptions", | ||
| "organizations_url": "https://api.github.com/users/Gaurav0/orgs", | ||
| "repos_url": "https://api.github.com/users/Gaurav0/repos", | ||
| "events_url": "https://api.github.com/users/Gaurav0/events{/privacy}", | ||
| "received_events_url": "https://api.github.com/users/Gaurav0/received_events", | ||
| "type": "User", | ||
| "site_admin": false | ||
| }, | ||
| "version": "e0c766099ae77ceaa4fafc0a61f536b469fe4840", | ||
| "committed_at": "2015-07-23T22:48:50Z", | ||
| "change_status": { | ||
| "total": 1, | ||
| "additions": 1, | ||
| "deletions": 0 | ||
| }, | ||
| "url": "https://api.github.com/gists/35de43cb81fc35ddffb2/e0c766099ae77ceaa4fafc0a61f536b469fe4840" | ||
| }, | ||
| { | ||
| "user": { | ||
| "login": "Gaurav0", | ||
| "id": 313960, | ||
| "avatar_url": "https://avatars.githubusercontent.com/u/313960?v=3", | ||
| "gravatar_id": "", | ||
| "url": "https://api.github.com/users/Gaurav0", | ||
| "html_url": "https://github.com/Gaurav0", | ||
| "followers_url": "https://api.github.com/users/Gaurav0/followers", | ||
| "following_url": "https://api.github.com/users/Gaurav0/following{/other_user}", | ||
| "gists_url": "https://api.github.com/users/Gaurav0/gists{/gist_id}", | ||
| "starred_url": "https://api.github.com/users/Gaurav0/starred{/owner}{/repo}", | ||
| "subscriptions_url": "https://api.github.com/users/Gaurav0/subscriptions", | ||
| "organizations_url": "https://api.github.com/users/Gaurav0/orgs", | ||
| "repos_url": "https://api.github.com/users/Gaurav0/repos", | ||
| "events_url": "https://api.github.com/users/Gaurav0/events{/privacy}", | ||
| "received_events_url": "https://api.github.com/users/Gaurav0/received_events", | ||
| "type": "User", | ||
| "site_admin": false | ||
| }, | ||
| "version": "b42740fa0ee5b3af9ef29c005b10906932dad930", | ||
| "committed_at": "2015-07-23T22:30:30Z", | ||
| "change_status": { | ||
| "total": 24, | ||
| "additions": 24, | ||
| "deletions": 0 | ||
| }, | ||
| "url": "https://api.github.com/gists/35de43cb81fc35ddffb2/b42740fa0ee5b3af9ef29c005b10906932dad930" | ||
| } | ||
| ] | ||
| } | ||
| */ | ||
|
|
||
|
|
||
|
|
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| /** | ||
| * This is a factory definition for an owner | ||
| */ | ||
| import Mirage, { faker } from 'ember-cli-mirage'; | ||
|
|
||
| export default Mirage.Factory.extend({ | ||
| id: faker.random.number(99999), | ||
| avatar_url() { | ||
| return `https://avatars.githubusercontent.com/u/${this.id}?v=3`; | ||
| }, | ||
| gravatar_id: "", | ||
| url() { | ||
| return "https://api.github.com/users/" + this.login; | ||
| }, | ||
| html_url() { | ||
| return "https://github.com/" + this.login; | ||
| }, | ||
| followers_url() { | ||
| return `https://api.github.com/users/${this.login}/followers`; | ||
| }, | ||
| following_url() { | ||
| return `https://api.github.com/users/${this.login}/following{/other_user}`; | ||
| }, | ||
| gists_url() { | ||
| return `https://api.github.com/users/${this.login}/gists{/gist_id}`; | ||
| }, | ||
| starred_url() { | ||
| return `https://api.github.com/users/${this.login}/starred{/owner}{/repo}`; | ||
| }, | ||
| subscriptions_url() { | ||
| return `https://api.github.com/users/${this.login}/subscriptions`; | ||
| }, | ||
| organizations_url() { | ||
| return `https://api.github.com/users/${this.login}/orgs`; | ||
| }, | ||
| repos_url() { | ||
| return `https://api.github.com/users/${this.login}/repos`; | ||
| }, | ||
| events_url() { | ||
| return `https://api.github.com/users/${this.login}/events{/privacy}`; | ||
| }, | ||
| received_events_url() { | ||
| return `https://api.github.com/users/${this.login}/received_events`; | ||
| }, | ||
| type: "User", | ||
| site_admin: false | ||
| }); | ||
|
|
||
| /* Sample | ||
| "owner": { | ||
| "login": "Gaurav0", | ||
| "id": 313960, | ||
| "avatar_url": "https://avatars.githubusercontent.com/u/313960?v=3", | ||
| "gravatar_id": "", | ||
| "url": "https://api.github.com/users/Gaurav0", | ||
| "html_url": "https://github.com/Gaurav0", | ||
| "followers_url": "https://api.github.com/users/Gaurav0/followers", | ||
| "following_url": "https://api.github.com/users/Gaurav0/following{/other_user}", | ||
| "gists_url": "https://api.github.com/users/Gaurav0/gists{/gist_id}", | ||
| "starred_url": "https://api.github.com/users/Gaurav0/starred{/owner}{/repo}", | ||
| "subscriptions_url": "https://api.github.com/users/Gaurav0/subscriptions", | ||
| "organizations_url": "https://api.github.com/users/Gaurav0/orgs", | ||
| "repos_url": "https://api.github.com/users/Gaurav0/repos", | ||
| "events_url": "https://api.github.com/users/Gaurav0/events{/privacy}", | ||
| "received_events_url": "https://api.github.com/users/Gaurav0/received_events", | ||
| "type": "User", | ||
| "site_admin": false | ||
| }, | ||
| */ |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| export default function(/* server */) { | ||
|
|
||
| // Seed your development database using your factories. This | ||
| // data will not be loaded in your tests. | ||
|
|
||
| // server.createList('contact', 10); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we store this in
config/environment.js? That allows us to have a different value in the test environment from development/production, and should allow you to remove thehostcomputed.