aboutsummaryrefslogtreecommitdiffstats
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
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.
-rw-r--r--app/views/refinery/blog/posts/_post.html.erb8
-rw-r--r--app/views/refinery/blog/posts/show.html.erb20
-rw-r--r--spec/requests/manage_blog_posts_spec.rb37
3 files changed, 46 insertions, 19 deletions
diff --git a/app/views/refinery/blog/posts/_post.html.erb b/app/views/refinery/blog/posts/_post.html.erb
index 12978d3..0806c1a 100644
--- a/app/views/refinery/blog/posts/_post.html.erb
+++ b/app/views/refinery/blog/posts/_post.html.erb
@@ -8,12 +8,12 @@
<h1><%= @blog_post.title %></h1>
<section class='details'>
<time datetime="<%=l @blog_post.published_at.to_date, :format => :default %>" class='posted_at'>
- <%= t('created_at', :scope => 'blog.shared.posts', :when => l(@blog_post.published_at.to_date, :format => :short)) %>
+ <%= t('created_at', :scope => 'refinery.blog.shared.posts', :when => l(@blog_post.published_at.to_date, :format => :short)) %>
</time>
- <%= "#{t('by', :scope => 'blog.posts.show')} #{@blog_post.author.username}" if @blog_post.author.present? %>.
+ <%= "#{t('by', :scope => 'refinery.blog.posts.show')} #{@blog_post.author.username}" if @blog_post.author.present? %>.
<% if (categories = @blog_post.categories).any? %>
<aside class='filed_in'>
- <%= t('filed_in', :scope => 'blog.posts.show') %>
+ <%= t('filed_in', :scope => 'refinery.blog.posts.show') %>
<% categories.each_with_index do |category, index| %>
<%= link_to category.title, blog_category_url(category) -%><%= ',' if index < ((categories.length) - 1) %>
<% end %>
@@ -23,7 +23,7 @@
</header>
<%= @blog_post.body.html_safe %>
- <% if BlogPost::ShareThis.enabled? %>
+ <% if Refinery::BlogPost::ShareThis.enabled? %>
<span class="st_sharethis" displayText="ShareThis"></span>
<% end %>
</article>
diff --git a/app/views/refinery/blog/posts/show.html.erb b/app/views/refinery/blog/posts/show.html.erb
index cc763a8..bdd149f 100644
--- a/app/views/refinery/blog/posts/show.html.erb
+++ b/app/views/refinery/blog/posts/show.html.erb
@@ -3,14 +3,14 @@
<%= render 'post' %>
</div>
- <% if BlogPost.comments_allowed? %>
+ <% if Refinery::BlogPost.comments_allowed? %>
<aside id="comments">
<h2><%= t('.comments.title') %></h2>
<% if (comments = @blog_post.comments.approved).any? %>
<%= render :partial => "comment", :collection => comments %>
<% else %>
<p>
- <%= t('none', :scope => 'blog.shared.comments') %>.
+ <%= t('none', :scope => 'refinery.blog.shared.comments') %>.
</p>
<% end %>
@@ -21,8 +21,8 @@
<% end %>
<h2><%= t('.comments.add') %></h2>
- <%= form_for [:blog_post, @blog_comment] do |f| %>
- <%= render :partial => "/shared/admin/error_messages",
+ <%= form_for [main_app, :blog_post, @blog_comment] do |f| %>
+ <%= render :partial => "/refinery/admin/error_messages",
:locals => {
:object => f.object,
:include_object_name => true
@@ -48,14 +48,14 @@
<% end %>
<% content_for :body_content_right do %>
- <%= render :partial => "/blog/shared/categories" %>
- <%= render :partial => "/blog/shared/tags" %>
- <%= render :partial => "/blog/shared/posts" %>
- <%= render :partial => "/blog/shared/rss_feed" %>
+ <%= render :partial => "/refinery/blog/shared/categories" %>
+ <%= render :partial => "/refinery/blog/shared/tags" %>
+ <%= render :partial => "/refinery/blog/shared/posts" %>
+ <%= render :partial => "/refinery/blog/shared/rss_feed" %>
<%= blog_archive_list %>
<% end %>
-<%= render :partial => "/shared/content_page", :locals => { :remove_automatic_sections => true } %>
+<%= render :partial => "/refinery/content_page", :locals => { :remove_automatic_sections => true } %>
<% content_for :stylesheets, stylesheet_link_tag('refinerycms-blog') %>
<% content_for :before_javascript_libraries, jquery_include_tags(:jquery_ui => false) %>
@@ -64,4 +64,4 @@
<%#= javascript_include_tag('refinerycms-blog') %>
<script src="http://w.sharethis.com/button/buttons.js"></script>
<script>stLight.options({publisher:'<%= BlogPost::ShareThis.key %>'});</script>
-<% end if BlogPost::ShareThis.enabled? %>
+<% end if Refinery::BlogPost::ShareThis.enabled? %>
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