aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/requests/blog_posts_spec.rb18
-rw-r--r--spec/requests/manage_blog_posts_spec.rb22
2 files changed, 40 insertions, 0 deletions
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