From 8ef0075876181a1a441e47293333a1efd34c5e3f Mon Sep 17 00:00:00 2001 From: Xavier Shay Date: Fri, 7 Nov 2008 12:52:52 +1100 Subject: [PATCH] Feature for archives --- features/browsing.feature | 6 ++++++ features/steps/browsing.rb | 4 ++++ features/steps/factories.rb | 2 -- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/features/browsing.feature b/features/browsing.feature index 802d95c9a..ff479da3f 100644 --- a/features/browsing.feature +++ b/features/browsing.feature @@ -8,3 +8,9 @@ Feature: Browsing When I go to the home page Then I should see "This is a post" And I should see a link to all posts tagged "awesome" + + Scenario: browsing the archive, to find more content to read + Given there is at least one post titled "My Post" + When I go to the home page + And I follow "Archives" + Then I should see "My Post" diff --git a/features/steps/browsing.rb b/features/steps/browsing.rb index 2c877def1..3c95d1ebf 100644 --- a/features/steps/browsing.rb +++ b/features/steps/browsing.rb @@ -2,6 +2,10 @@ Factory(:post, :tags => [Factory(:tag, :name => tag_name)]) end +Given /there is at least one post titled "([\w\s]+)"/ do |title| + Factory(:post, :title => title) +end + Then /I should see a link to all posts tagged "([\w\s]+)"/ do |tag_name| # TODO: Use an xpath matcher rather than regex response.body.should =~ %r{awesome} diff --git a/features/steps/factories.rb b/features/steps/factories.rb index 3f2bb11cd..152ed4620 100644 --- a/features/steps/factories.rb +++ b/features/steps/factories.rb @@ -12,6 +12,4 @@ a.published_at Time.now a.created_at Time.now a.updated_at Time.now - - a.tags {|t| t.association(:tags) } end