From 3e7f4a7168c59b18c498d262ea34284b8cdf9f3d Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Tue, 19 Jul 2011 19:22:53 +0000 Subject: [PATCH] Refactor playlists features --- features/playlists.feature | 11 ++++++----- features/step_definitions/playlists_step.rb | 9 ++------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/features/playlists.feature b/features/playlists.feature index 41586a8..2c82f4e 100644 --- a/features/playlists.feature +++ b/features/playlists.feature @@ -5,20 +5,21 @@ Feature: Playlists I want to manage some playlists Scenario: List playlists - Given Foo and Bar playlists + Given a playlist named "Electro" + And a playlist named "Reggae" When I am on the playlists page - Then I should see "Foo" within "ul>li" - And I should see "Bar" within "ul>li+li" + Then I should see "Electro" within "ul>li:first-child" + And I should see "Reggae" within "ul>li:first-child+li" Scenario: Create playlist Given I am on the playlists page When I follow "Create playlist" And I fill in "Name" with "Electro" And I press "Create" - Then I should see "Electro" within "ul>li" + Then I should see "Electro" within "ul>li:first-child" Scenario: Edit playlist - Given a playlist named Electro + Given a playlist named "Electro" And I am on the playlists page When I follow "Electro" And I fill in "Name" with "Rock" diff --git a/features/step_definitions/playlists_step.rb b/features/step_definitions/playlists_step.rb index 5b4513b..57ea2c1 100644 --- a/features/step_definitions/playlists_step.rb +++ b/features/step_definitions/playlists_step.rb @@ -1,8 +1,3 @@ -Given /^Foo and Bar playlists$/ do - @foo = Playlist.create!(:name => 'Foo') - @bar = Playlist.create!(:name => 'Bar') -end - -Given /^a playlist named Electro$/ do - Playlist.create!(:name => 'Electro') +Given /^a playlist named "([^"]*)"$/ do |name| + Playlist.create!(:name => name) end