From 6ae3a2d7fa3ac3bc9ca0e855d272241cc2b3603d Mon Sep 17 00:00:00 2001 From: Armando Fox Date: Fri, 3 Feb 2012 10:57:03 -0800 Subject: [PATCH] added feature files and step def skeletons --- features/filter_movie_list.feature | 24 ++++++++++++++++++ features/sort_movie_list.feature | 31 ++++++++++++++++++++++++ features/step_definitions/movie_steps.rb | 18 ++++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 features/filter_movie_list.feature create mode 100644 features/sort_movie_list.feature create mode 100644 features/step_definitions/movie_steps.rb diff --git a/features/filter_movie_list.feature b/features/filter_movie_list.feature new file mode 100644 index 000000000..1cd65f5fe --- /dev/null +++ b/features/filter_movie_list.feature @@ -0,0 +1,24 @@ +Feature: display list of movies filtered by MPAA rating + + As a concerned parent + So that I can quickly browse movies appropriate for my family + I want to see movies matching only certain MPAA ratings + +Background: movies have been added to database + + Given the following movies exist: + | title | rating | release_date | + | Aladdin | G | 25-Nov-1992 | + | The Terminator | R | 26-Oct-1984 | + | When Harry Met Sally | R | 21-Jul-1989 | + | The Help | PG-13 | 10-Aug-2011 | + | Chocolat | PG-13 | 5-Jan-2001 | + | Amelie | R | 25-Apr-2001 | + | 2001: A Space Odyssey | G | 6-Apr-1968 | + | The Incredibles | PG | 5-Nov-2004 | + | Raiders of the Lost Ark | PG | 12-Jun-1981 | + | Chicken Run | G | 21-Jun-2000 | + + + + diff --git a/features/sort_movie_list.feature b/features/sort_movie_list.feature new file mode 100644 index 000000000..116ced984 --- /dev/null +++ b/features/sort_movie_list.feature @@ -0,0 +1,31 @@ +Feature: display list of movies sorted by different criteria + + As an avid moviegoer + So that I can quickly browse movies based on my preferences + I want to be able to sort movies by title or release date + +Background: movies are added to database + + Given I have added the following movies: + | title | rating | release_date | + | Aladdin | G | 25-Nov-1992 | + | The Terminator | R | 26-Oct-1984 | + | When Harry Met Sally | R | 21-Jul-1989 | + | The Help | PG-13 | 10-Aug-2011 | + | Chocolat | PG-13 | 5-Jan-2001 | + | Amelie | R | 25-Apr-2001 | + | 2001: A Space Odyssey | G | 6-Apr-1968 | + | The Incredibles | PG | 5-Nov-2004 | + | Raiders of the Lost Ark | PG | 12-Jun-1981 | + | Chicken Run | G | 21-Jun-2000 | + +Feature: sort movies alphabetically + + Given I am on the RottenPotatoes home page + # your steps here + +Feature: sort movies in increasing order of release_date + + Given I am on the RottenPotatoes home page + # your steps here + diff --git a/features/step_definitions/movie_steps.rb b/features/step_definitions/movie_steps.rb new file mode 100644 index 000000000..e8bc1eecb --- /dev/null +++ b/features/step_definitions/movie_steps.rb @@ -0,0 +1,18 @@ +# Add a declarative step here for populating the DB with movies. + +Given /the following movies exist/ do |movies_table| + movies_table.hashes.each do |movie| + # each returned element will be a hash whose key is the table header. + # you should arrange to add that movie to the database here. + end +end + +# Make sure that one string (regexp) occurs before or after another one +# on the same page + +Then "I should see (.*) (before|after) (.*)" do |e1, order, e2| + # assign a variable 'regex' here that creates a regular expression + # to match the page content against, to make sure that e1 occurs + # before or after e2 as specified in the step. + page.content.should match(regex) +end