aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorUģis Ozols <ugis.ozolss@gmail.com>2011-07-28 12:05:43 +0300
committerUģis Ozols <ugis.ozolss@gmail.com>2011-07-28 12:05:43 +0300
commit3475603f72ff0b3e051542908199b5bab3f47b14 (patch)
tree3733899359f932dda1fd1913459189f4f76f9086 /spec
parent106571cdedb19a749479cf1f8ac6fafea7baea58 (diff)
downloadrefinerycms-blog-3475603f72ff0b3e051542908199b5bab3f47b14.tar.gz
refinerycms-blog-3475603f72ff0b3e051542908199b5bab3f47b14.tar.bz2
refinerycms-blog-3475603f72ff0b3e051542908199b5bab3f47b14.zip
More request specs and updates to code to make specs pass.
Diffstat (limited to 'spec')
-rw-r--r--spec/requests/manage_blog_posts_spec.rb37
1 files changed, 32 insertions, 5 deletions
diff --git a/spec/requests/manage_blog_posts_spec.rb b/spec/requests/manage_blog_posts_spec.rb
index a44c23c..2b7cb6c 100644
--- a/spec/requests/manage_blog_posts_spec.rb
+++ b/spec/requests/manage_blog_posts_spec.rb
@@ -41,7 +41,7 @@ describe "manage blog posts" do
context "when editing blog post" do
it "should succeed" do
visit refinery_admin_blog_posts_path
- page.should have_content("Refinery CMS blog post")
+ page.should have_content(blog_post.title)
click_link("Edit this blog post")
current_path.should == edit_refinery_admin_blog_post_path(blog_post)
@@ -49,23 +49,50 @@ describe "manage blog posts" do
fill_in "Title", :with => "hax0r"
click_button "Save"
- page.should_not have_content("Refinery CMS blog post")
+ page.should_not have_content(blog_post.title)
page.should have_content("'hax0r' was successfully updated.")
# this probably is matching the same 'hax0r' in flash message!?
page.should have_content("hax0r")
end
end
-
+
context "when deleting blog post" do
it "should succeed" do
pending "need to figure out how to accept js popup"
visit refinery_admin_blog_posts_path
- page.should have_content("Refinery CMS blog post")
+ page.should have_content(blog_post.title)
click_link "Remove this blog post forever"
- page.should_not have_content("Refinery CMS blog post")
+ page.should_not have_content(blog_post.title)
+ end
+ end
+
+ context "uncategorized post" do
+ it "shows up in the list" do
+ visit uncategorized_refinery_admin_blog_posts_path
+ page.should have_content(blog_post.title)
+ end
+ end
+
+ context "categorized post" do
+ it "won't show up in the list" do
+ blog_post.categories << Factory(:blog_category)
+ blog_post.save!
+
+ visit uncategorized_refinery_admin_blog_posts_path
+ page.should_not have_content(blog_post.title)
+ end
+ end
+
+ describe "view live" do
+ it "redirects to blog post in the frontend" do
+ visit refinery_admin_blog_posts_path
+ click_link "View this blog post live"
+
+ current_path.should == blog_post_path(blog_post)
+ page.should have_content(blog_post.title)
end
end
end