Created
April 15, 2011 18:25
-
-
Save gmoeck/922194 to your computer and use it in GitHub Desktop.
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
FakeServer.addResourceType('Item', { type: 'Boat' }); | |
FakeServer.addResource('Item', {title: 'Super Boat' }); | |
FakeServer.registerUrl('/search_for_item', function(resourceStore){ | |
var items = resourceStore.allOfType('Item'); | |
var response = { | |
items: items | |
} | |
return response; | |
}); | |
// gives '{"items": [ {"type": "Boat", "title": "Super Boat"} ] }' | |
// designed to be used with the bellow executable user story |
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
Scenario('Searching For An Item', function() { | |
Given('an auction item that is available for sale', function() { | |
var itemTitle = 'item'; | |
beforeEach(function() { | |
Application.server.addResource('Item', {title: itemTitle}); | |
}); | |
When('I am on the homepage of the application', function() { | |
beforeEach(function() { | |
Application.statechart.gotoState('started'); | |
}); | |
And('I search for that auction item', function() { | |
beforeEach(function() { | |
WebPage.fillIn('#mainSearchWidget .search-field-view input[type="text"]', itemTitle); | |
WebPage.clickOn('#mainSearchWidget .submit-search'); | |
}); | |
Then('I should see the auction item within the search results', function(page) { | |
WebPage.within('.search-results', function(page) { | |
expect(page).toHaveContent(itemTitle); | |
}); | |
}); | |
}); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment