From ee215655cba5820c3ffe0c665ea71c11f15f3bf9 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Thu, 4 Aug 2011 15:39:04 -0700 Subject: Replace cucumber tag features with rspec request tests Remove cucumber support from project --- spec/requests/blog_posts_spec.rb | 18 ++++++++++++++++++ spec/requests/manage_blog_posts_spec.rb | 22 ++++++++++++++++++++++ 2 files changed, 40 insertions(+) (limited to 'spec/requests') diff --git a/spec/requests/blog_posts_spec.rb b/spec/requests/blog_posts_spec.rb index 1eaf27a..d7d2a9f 100644 --- a/spec/requests/blog_posts_spec.rb +++ b/spec/requests/blog_posts_spec.rb @@ -17,4 +17,22 @@ describe "blog posts" do response.content_type.should eq("application/rss+xml") end end + + describe "list tagged posts" do + context "when has tagged blog posts" do + before(:each) do + @tag_name = "chicago" + @blog_post = Factory.create(:blog_post, + :title => "I Love my city", + :tag_list => @tag_name) + tag = ::Refinery::BlogPost.tag_counts_on(:tags).first + visit tagged_posts_path(tag.id, @tag_name.parameterize) + end + + it "should have one tagged post" do + page.should have_content(@tag_name) + page.should have_content(@blog_post.title) + end + end + end end diff --git a/spec/requests/manage_blog_posts_spec.rb b/spec/requests/manage_blog_posts_spec.rb index 12b7b8f..6d6f734 100644 --- a/spec/requests/manage_blog_posts_spec.rb +++ b/spec/requests/manage_blog_posts_spec.rb @@ -55,6 +55,28 @@ describe "manage blog posts" do ::Refinery::BlogPost.last.categories.first.title.should eq(blog_category.title) end end + + describe "create blog post with tags" do + before(:each) do + @tag_list = "chicago, bikes, beers, babes" + fill_in "Title", :with => "This is a tagged blog post" + fill_in "blog_post_body", :with => "And I also love it" + fill_in "Tags", :with => @tag_list + click_button "Save" + end + + it "should succeed" do + page.should have_content("was successfully added.") + end + + it "should be the only blog post" do + ::Refinery::BlogPost.all.size.should eq(1) + end + + it "should have the specified tags" do + ::Refinery::BlogPost.last.tag_list.should eq(@tag_list.split(', ')) + end + end end end -- cgit v1.2.3