Skip to content

Commit

Permalink
hw3 - part2a
Browse files Browse the repository at this point in the history
  • Loading branch information
mdlima committed Mar 18, 2012
1 parent f97d107 commit 18b3a62
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
Binary file modified db/development.sqlite3
Binary file not shown.
21 changes: 21 additions & 0 deletions features/filter_movie_list.feature
Expand Up @@ -23,10 +23,31 @@ Background: movies have been added to database

Scenario: restrict to movies with 'PG' or 'R' ratings
# enter step(s) to check the 'PG' and 'R' checkboxes
When I check rating "PG"
And I check rating "R"
# enter step(s) to uncheck all other checkboxes
And I uncheck rating "G"
And I uncheck rating "PG-13"
And I uncheck rating "NC-17"
# enter step to "submit" the search form on the homepage
And I press "Refresh"

# enter step(s) to ensure that PG and R movies are visible
Then I should see the movies:
| title | rating | release_date |
| The Terminator | R | 26-Oct-1984 |
| When Harry Met Sally | R | 21-Jul-1989 |
| Amelie | R | 25-Apr-2001 |
| The Incredibles | PG | 5-Nov-2004 |
| Raiders of the Lost Ark | PG | 12-Jun-1981 |
# enter step(s) to ensure that other movies are not visible
And I should not see the movies:
| title | rating | release_date |
| Aladdin | G | 25-Nov-1992 |
| The Help | PG-13 | 10-Aug-2011 |
| Chocolat | PG-13 | 5-Jan-2001 |
| 2001: A Space Odyssey | G | 6-Apr-1968 |
| Chicken Run | G | 21-Jun-2000 |

Scenario: no ratings selected
# see assignment
Expand Down
14 changes: 14 additions & 0 deletions features/step_definitions/movie_steps.rb
Expand Up @@ -28,3 +28,17 @@
# iterate over the ratings and reuse the "When I check..." or
# "When I uncheck..." steps in lines 89-95 of web_steps.rb
end

Then /I should see the movies/ do |movies_table|
movies_table.hashes.each do |movie|
step %Q{I should see "#{movie[:title]}"}
end
# assert false, "Unimplemented"
end

Then /I should not see the movies/ do |movies_table|
movies_table.hashes.each do |movie|
step %Q{I should not see "#{movie[:title]}"}
end
# assert false, "Unimplemented"
end
8 changes: 8 additions & 0 deletions features/step_definitions/web_steps.rb
Expand Up @@ -90,10 +90,18 @@ def with_scope(locator)
check(field)
end

When /^(?:|I )check rating "([^"]*)"$/ do |field|
check("ratings_" + field)
end

When /^(?:|I )uncheck "([^"]*)"$/ do |field|
uncheck(field)
end

When /^(?:|I )uncheck rating "([^"]*)"$/ do |field|
uncheck("ratings_" + field)
end

When /^(?:|I )choose "([^"]*)"$/ do |field|
choose(field)
end
Expand Down

0 comments on commit 18b3a62

Please sign in to comment.