Created
July 19, 2009 09:00
-
-
Save jschoolcraft/149855 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
| Feature: the homepage | |
| # TODO: Add code for comments count | |
| Scenario: A visitor should the latest published posts | |
| Given the following posts | |
| | title | body | published_at | created_at | | |
| | Post #1 | This is post #1 | 14 July 2009 23:49:04 | 14 July 2009 23:49:04 | | |
| | Post #2 | This is post #2 | | 15 July 2009 23:49:04 | | |
| | Post #3 | This is post #3 | 16 July 2009 23:49:04 | 16 July 2009 23:49:04 | | |
| | Post #4 | This is post #4 | | 17 July 2009 23:49:04 | | |
| When I am on "the homepage" | |
| Then I should see "Post #3" | |
| And I should see "This is post #3" | |
| And I should see "July 16, 2009" | |
| And I should see "by Eric Milford" | |
| # Where does "by Eric Milford" get set, it's not obvious from your Givens. | |
| Scenario: A visitor should see "no posts" messages if there are no posts | |
| Given the following posts | |
| | title | body | published_at | created_at | | |
| When I am on "the homepage" | |
| Then I should see "Oops, no posts found." | |
| And I should see "No recent posts" | |
| # I would probably do something like: | |
| Given there are no posts | |
| ... | |
| # then in steps.rb for this do something like: Post.delete_all | |
| # JEFF: How can I verify that the title is linked? Or is that a separate scenario? When I click the title... | |
| # I would make this two scenario's. You verify with follow. Maybe something like: | |
| Scenario: Clicking on link title should bring reader to the full post | |
| Given the following posts | |
| 1 post here... | |
| And I am on the homepage | |
| When I follow "Post Title" | |
| Then I should be on the post page for "Post Title" | |
| And I should see "Something in body that wasn't in the excerpt/summary" | |
| .... | |
| Scenario: A visitor should see the 3 most recent published posts, not including the latest | |
| Given the following posts | |
| | title | body | published_at | created_at | | |
| | Post #1 | This is post #1 | 14 July 2009 23:49:04 | 14 July 2009 23:49:04 | | |
| | Post #2 | This is post #2 | | 15 July 2009 23:49:04 | | |
| | Post #3 | This is post #3 | 16 July 2009 23:49:04 | 16 July 2009 23:49:04 | | |
| | Post #4 | This is post #4 | 17 July 2009 23:49:04 | 17 July 2009 23:49:04 | | |
| | Post #5 | This is post #5 | | 18 July 2009 23:49:04 | | |
| | Post #6 | This is post #6 | 19 July 2009 23:49:04 | 19 July 2009 23:49:04 | | |
| When I am on "the homepage" | |
| Then I should see "Post #4" | |
| And I should see "Eric Milford on July 17, 2009" | |
| And I should see "Post #3" | |
| And I should see "Eric Milford on July 16, 2009" | |
| And I should see "Post #1" | |
| And I should see "Eric Milford on July 14, 2009" | |
| # You might have also said, "A visitor only sees published posts" for ^^^^^^^^^ | |
| Scenario: A visitor should see the 3 most recent approved comments | |
| Given the following posts | |
| | title | body | published_at | created_at | id | | |
| | Post #1 | This is post #1 | 14 July 2009 23:49:04 | 14 July 2009 23:49:04 | 1 | | |
| | Post #2 | This is post #2 | 15 July 2009 23:49:04 | 15 July 2009 23:49:04 | 2 | | |
| And the following comments | |
| | body | approved | created_at | post_id | author_name | | |
| | This is comment #1 | true | 13 July 2009 23:49:04 | 1 | Joe U. | | |
| | This is comment #2 | false | 14 July 2009 23:49:04 | 1 | Mary P. | | |
| | This is comment #3 | true | 15 July 2009 23:49:04 | 2 | Ray R. | | |
| | This is comment #4 | true | 16 July 2009 23:49:04 | 1 | Eric M. | | |
| When I am on "the homepage" | |
| Then I should see "This is comment #4" | |
| And I should see "Eric M. on Post #1" | |
| And I should see "This is comment #3" | |
| And I should see "Ray R. on Post #2" | |
| And I should see "This is comment #1" | |
| And I should see "Joe U. on Post #1" | |
| # it doesn't seem like you have enough data for this to be a valid scenario. You only have 3 approved comments. Either this should be "only sees approved comments" or you should add more approved comments and only see the latest 3. But it's probably two features (Sees only approved comments, only sees latest 3) | |
| # JEFF: How can I test for the presence of an image? | |
| # Scenario: A visitor should see the thumbnail image for the 3 most recent published photo albums | |
| # Given the following photo albums | |
| # | title | description | path | published | | |
| # | Album 1 | This is album #1 | /photos/album_1 | true | | |
| # | Album 2 | This is album #2 | /photos/album_1 | false | | |
| # | Album 3 | This is album #3 | /photos/album_1 | true | | |
| # | Album 4 | This is album #4 | /photos/album_1 | true | | |
| # When I am on "the homepage" | |
| # Then ... | |
| # Then I should see thumbnail for /photos/album_1 | |
| ## album_steps.rb | |
| Then /^I should see thumbnail for "([^\"]*)"$/ do |album_path| | |
| album = Album.find_by_path(album_path) | |
| response.should have_tag("img").with .... # I'd have to do more searching for this | |
| end | |
| # Then follow it with an ID | |
| # or nest them.... | |
| response.should have_tag("a") do |a| | |
| a.should have_tag("img") | |
| end | |
| # http://github.com/brynary/webrat/blob/e5ae16367cfd656617815fd9b9c405bc6bb3a97d/spec/public/matchers_spec.rb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment