diff --git a/db/development.sqlite3 b/db/development.sqlite3 index bd4ebb8e4..6e45c91f6 100644 Binary files a/db/development.sqlite3 and b/db/development.sqlite3 differ diff --git a/features/filter_movie_list.feature b/features/filter_movie_list.feature index 635eadd1e..ca12a8228 100644 --- a/features/filter_movie_list.feature +++ b/features/filter_movie_list.feature @@ -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 diff --git a/features/step_definitions/movie_steps.rb b/features/step_definitions/movie_steps.rb index 40155e5d7..d19b3f6b7 100644 --- a/features/step_definitions/movie_steps.rb +++ b/features/step_definitions/movie_steps.rb @@ -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 diff --git a/features/step_definitions/web_steps.rb b/features/step_definitions/web_steps.rb index 4d9aab645..1620b4b73 100644 --- a/features/step_definitions/web_steps.rb +++ b/features/step_definitions/web_steps.rb @@ -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