aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models
diff options
context:
space:
mode:
authorJeff Shumate <jeff@catapulsion.net>2012-01-25 22:27:46 -0700
committerJeff Shumate <jeff@catapulsion.net>2012-01-25 22:27:46 -0700
commite274bb1757aa3c27645c181bae6164131a7a35dd (patch)
tree2c896df9bd0a66aa288bfdf8f30fe767516ec0bc /spec/models
parentd1ad82d42eceb53b203716e1c37f4fbb326a2ee8 (diff)
downloadrefinerycms-blog-e274bb1757aa3c27645c181bae6164131a7a35dd.tar.gz
refinerycms-blog-e274bb1757aa3c27645c181bae6164131a7a35dd.tar.bz2
refinerycms-blog-e274bb1757aa3c27645c181bae6164131a7a35dd.zip
add source url for post
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/refinery/blog/post_spec.rb35
1 files changed, 33 insertions, 2 deletions
diff --git a/spec/models/refinery/blog/post_spec.rb b/spec/models/refinery/blog/post_spec.rb
index 60a04ec..fb7e3b1 100644
--- a/spec/models/refinery/blog/post_spec.rb
+++ b/spec/models/refinery/blog/post_spec.rb
@@ -212,9 +212,40 @@ module Refinery
subject.class.teasers_enabled?.should be_false
end
end
-
end
-
+
+ describe "source url" do
+ it "should allow a source url and title" do
+ p = FactoryGirl.create(:blog_post, :source_url => 'google.com', :source_url_title => 'author')
+ p.should be_valid
+ p.source_url.should include('google')
+ p.source_url_title.should include('author')
+ end
+ end
+
+ describe ".validate_source_url?" do
+ context "with Refinery::Setting validate_source_url set to true" do
+ before do
+ Refinery::Setting.set(:validate_source_url, { :scoping => 'blog', :value => true })
+ Refinery::Blog.validate_source_url = true
+ end
+ it "should have canonical url" do
+ p = FactoryGirl.create(:blog_post, :source_url => 'google.com', :source_url_title => 'google')
+ p.source_url.should include('www')
+ end
+ end
+ context "with Refinery::Setting validate_source_url set to false" do
+ before do
+ Refinery::Setting.set(:validate_source_url, { :scoping => 'blog', :value => false })
+ Refinery::Blog.validate_source_url = false
+ end
+ it "should have original url" do
+ p = FactoryGirl.create(:blog_post, :source_url => 'google.com', :source_url_title => 'google')
+ p.source_url.should_not include('www')
+ end
+ end
+ end
+
end
end
end \ No newline at end of file