aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models
diff options
context:
space:
mode:
authorJohan Bruning <johan.h.bruning@gmail.com>2011-07-04 16:22:48 +0200
committerJohan Bruning <johan.h.bruning@gmail.com>2011-07-04 16:22:48 +0200
commit8d031ed0c717a32f6a5ad28ccd37e748026dc21c (patch)
treeeee0f8d60909f9000dfb2649909dd1edbb23dc95 /spec/models
parent0e4dbb28e923ca2a9065f23ba433ce74f9f0d42d (diff)
downloadrefinerycms-blog-8d031ed0c717a32f6a5ad28ccd37e748026dc21c.tar.gz
refinerycms-blog-8d031ed0c717a32f6a5ad28ccd37e748026dc21c.tar.bz2
refinerycms-blog-8d031ed0c717a32f6a5ad28ccd37e748026dc21c.zip
Added ability to disable teaser independent of teaser length
I prefer full length articles at all times on blogs and don't like teasers. I added the ability for people to disable teasers so full articles will be shown by default. The teasers can e enabled just like comments from the admin page or trough the normal settings. However not sure if the post partial now is conform standards. Maybe the helper method "blog_post_teaser" could encapsulate the check which is now done in the view and return the full length article instead of a teaser if the teasers are disabled.
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/blog_post_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/models/blog_post_spec.rb b/spec/models/blog_post_spec.rb
index 5642446..1b6bf9b 100644
--- a/spec/models/blog_post_spec.rb
+++ b/spec/models/blog_post_spec.rb
@@ -190,4 +190,28 @@ describe BlogPost do
Factory.create(:blog_post, :custom_teaser => 'This is some custom content').should be_valid
end
end
+
+ describe ".teasers_enabled?" do
+ context "with RefinerySetting teasers_enabled set to true" do
+ before do
+ RefinerySetting.set(:teasers_enabled, { :scoping => 'blog', :value => true })
+ end
+
+ it "should be true" do
+ BlogPost.teasers_enabled?.should be_true
+ end
+ end
+
+ context "with RefinerySetting teasers_enabled set to true" do
+ before do
+ RefinerySetting.set(:teasers_enabled, { :scoping => 'blog', :value => false })
+ end
+
+ it "should be false" do
+ BlogPost.teasers_enabled?.should be_false
+ end
+ end
+
+ end
+
end