test/test_serious.rb in serious-0.2.0 vs test/test_serious.rb in serious-0.2.1
- old
+ new
@@ -14,10 +14,12 @@
should_contain_text "Serious Test Blog", "#header h1 a"
should_contain_elements 3, "ul#articles li"
should_contain_text "Merry Christmas!", "ul#articles li:first"
should_contain_text "Merry christmas, dear reader!", "ul#articles li:first"
+ should_contain_text "December 24th 2009", "ul#articles li:first .date"
+
should_not_contain_text "Lorem ipsum dolor...", "ul#articles li:first"
should_contain_text "Ruby is the shit!", "ul#articles"
should_contain_text "Some kind of introduction and summary", "ul#articles li"
should_not_contain_text "The number is 4", "ul#articles li"
@@ -48,10 +50,11 @@
setup { get '/2009/12' }
should_respond_with 200
should_set_cache_control_to 300
should_contain_text "Archives for 2009-12", "#container h2:first"
+ should_contain_text 'December 24th 2009', "ul.archives li"
should_contain_elements 2, "ul.archives li"
should_contain_text "Merry Christmas!", "ul.archives li:first"
should_contain_text "Ruby is the shit!", "ul.archives"
end
@@ -185,6 +188,81 @@
should_set_cache_control_to 300
should_contain_text "Merry Christmas!", "feed entry:first title"
should_contain_text "Christoph Olszowka", "feed entry:first author name:first"
end
+
+ # ===================================================================
+ # Tests for disqus integration
+ # ===================================================================
+ context "With disqus id set" do
+ setup { Serious.set :disqus, 'foobar' }
+ teardown { Serious.set :disqus, false}
+
+ context "GET /2009/12/24/merry-christmas" do
+ setup { get '/2009/12/24/merry-christmas' }
+
+ should_contain_text "View the discussion thread.", "#container .article noscript"
+ should_contain_elements 1, "#container #disqus_thread"
+ end
+ end
+
+ context "With disqus inactive" do
+ setup { Serious.set :disqus, false }
+
+ context "GET /2009/12/24/merry-christmas" do
+ setup { get '/2009/12/24/merry-christmas' }
+
+ should_not_contain_text "View the discussion thread.", "#container .article noscript"
+ should_contain_elements 0, "#container #disqus_thread"
+ end
+ end
+
+ # ===================================================================
+ # Tests for google analytics integration
+ # ===================================================================
+ context "With google analytics active" do
+ setup { Serious.set :google_analytics, 'analyticsid' }
+
+ context "GET /" do
+ setup { get '/' }
+
+ should_contain_elements 2, "body script"
+ end
+ end
+
+ context "With google analytics inactive" do
+ setup { Serious.set :google_analytics, false }
+
+ context "GET /" do
+ setup { get '/' }
+
+ should_contain_elements 0, "body script"
+ end
+ end
+
+ # ===================================================================
+ # Tests for feed url setting
+ # ===================================================================
+ context "With default feed url" do
+ context "GET /" do
+ setup { get '/' }
+
+ should_contain_attribute "href", "/atom.xml", "head link:last"
+ end
+ end
+
+ context "With custom feed url" do
+ setup do
+ @original_feed_url = Serious.feed_url
+ Serious.set :feed_url, 'http://feeds.feedburner.com/myfeedurl'
+ end
+ teardown { Serious.set :feed_url, @original_feed_url }
+
+ context "GET /" do
+ setup { get '/' }
+
+ should_contain_attribute "href", "http://feeds.feedburner.com/myfeedurl", "head link:last"
+ end
+ end
+
end