test/helpers/test_blogging.rb in nanoc-3.7.3 vs test/helpers/test_blogging.rb in nanoc-3.7.4

- old
+ new

@@ -12,11 +12,11 @@ item.stubs(:[]).with(:created_at).returns(Time.now - 1000) item.stubs(:[]).with(:title).returns('An Item') item.stubs(:[]).with(:custom_path_in_feed).returns(nil) item.stubs(:[]).with(:custom_url_in_feed).returns(nil) item.stubs(:[]).with(:excerpt).returns(nil) - item.stubs(:path).returns("/item/") + item.stubs(:path).returns('/item/') item.stubs(:[]).with(:author_name).returns(nil) item.stubs(:[]).with(:author_uri).returns(nil) item.stubs(:compiled_content).returns('item content') item end @@ -86,11 +86,11 @@ end def test_atom_feed if_have 'builder' do # Create items - @items = [ mock, mock_article, mock_article ] + @items = [mock, mock_article, mock_article] # Create item 0 @items[0].stubs(:[]).with(:kind).returns('item') # Create item 1 @@ -99,11 +99,11 @@ @items[1].stubs(:[]).with(:created_at).returns((Date.today - 2).to_s) @items[1].stubs(:[]).with(:title).returns('Item One') @items[1].stubs(:[]).with(:custom_path_in_feed).returns(nil) @items[1].stubs(:[]).with(:custom_url_in_feed).returns(nil) @items[1].stubs(:[]).with(:excerpt).returns(nil) - @items[1].stubs(:path).returns("/item1/") + @items[1].stubs(:path).returns('/item1/') @items[1].expects(:compiled_content).with(:snapshot => :pre).returns('item 1 content') # Create item 2 @items[2].expects(:compiled_content).with(:snapshot => :pre).returns('item 2 content') @@ -115,21 +115,21 @@ @item = mock @item.stubs(:[]).with(:title).returns('My Cool Blog') @item.stubs(:[]).with(:author_name).returns('Denis Defreyne') @item.stubs(:[]).with(:author_uri).returns('http://stoneship.org/') @item.stubs(:[]).with(:feed_url).returns(nil) - @item.stubs(:path).returns("/journal/feed/") + @item.stubs(:path).returns('/journal/feed/') # Check atom_feed end end def test_atom_feed_with_times if_have 'builder' do # Create items - @items = [ mock_item, mock_article, mock_article ] + @items = [mock_item, mock_article, mock_article] # Create item 1 @items[1].stubs(:[]).with(:updated_at).returns(Time.now - 500) @items[1].stubs(:[]).with(:created_at).returns(Time.now - 1000) @items[1].expects(:compiled_content).returns('item 1 content') @@ -147,21 +147,21 @@ @item = mock @item.stubs(:[]).with(:title).returns('My Cool Blog') @item.stubs(:[]).with(:author_name).returns('Denis Defreyne') @item.stubs(:[]).with(:author_uri).returns('http://stoneship.org/') @item.stubs(:[]).with(:feed_url).returns(nil) - @item.stubs(:path).returns("/journal/feed/") + @item.stubs(:path).returns('/journal/feed/') # Check atom_feed end end def test_atom_feed_without_articles if_have 'builder' do # Mock items - @items = [ mock_item, mock_item ] + @items = [mock_item, mock_item] # Mock site @site = mock @site.stubs(:config).returns({ :base_url => 'http://example.com' }) @@ -183,11 +183,11 @@ end def test_atom_feed_without_base_url if_have 'builder' do # Create items - @items = [ mock_item, mock_article ] + @items = [mock_item, mock_article] # Mock site @site = mock @site.stubs(:config).returns({:base_url => nil}) @@ -209,11 +209,11 @@ end def test_atom_feed_without_title if_have 'builder' do # Create items - @items = [ mock_item, mock_article ] + @items = [mock_item, mock_article] # Mock site @site = mock @site.stubs(:config).returns({ :base_url => 'http://example.com' }) @@ -235,11 +235,11 @@ end def test_atom_feed_without_author_name if_have 'builder' do # Create items - @items = [ mock_item, mock_article ] + @items = [mock_item, mock_article] # Mock site @site = mock @site.stubs(:config).returns({ :base_url => 'http://example.com' }) @@ -261,15 +261,15 @@ end def test_atom_feed_with_author_name_and_uri_from_content_item if_have 'builder' do # Create items - @items = [ mock_article ] + @items = [mock_article] # Create item 1 - @items[0].stubs(:[]).with(:author_name).returns("Don Alias") - @items[0].stubs(:[]).with(:author_uri).returns("http://don.example.com/") + @items[0].stubs(:[]).with(:author_name).returns('Don Alias') + @items[0].stubs(:[]).with(:author_uri).returns('http://don.example.com/') @items[0].expects(:compiled_content).returns('item 1 content') # Mock site @site = mock @site.stubs(:config).returns({ :base_url => 'http://example.com/' }) @@ -279,11 +279,11 @@ @item.stubs(:[]).with(:kind).returns(nil) @item.stubs(:[]).with(:title).returns('My Cool Blog') @item.stubs(:[]).with(:author_name).returns('Denis Defreyne') @item.stubs(:[]).with(:author_uri).returns('http://stoneship.org/') @item.stubs(:[]).with(:feed_url).returns(nil) - @item.stubs(:path).returns("/journal/feed/") + @item.stubs(:path).returns('/journal/feed/') # Check # TODO: Use xpath matchers for more specific test result = atom_feed # Still should keep feed level author @@ -309,11 +309,11 @@ end def test_atom_feed_without_author_uri if_have 'builder' do # Create items - @items = [ mock_item, mock_article ] + @items = [mock_item, mock_article] # Mock site @site = mock @site.stubs(:config).returns({ :base_url => 'http://example.com' }) @@ -335,11 +335,11 @@ end def test_atom_feed_without_articles_created_at if_have 'builder' do # Create items - @items = [ mock_item, mock_article, mock_article ] + @items = [mock_item, mock_article, mock_article] @items[1].stubs(:[]).with(:created_at).returns(Time.now.to_s) @items[2].stubs(:[]).with(:created_at).returns(nil) # Mock site @site = mock @@ -363,11 +363,11 @@ end def test_atom_feed_with_title_author_name_and_uri_as_params if_have 'builder' do # Create items - @items = [ mock_item, mock_article ] + @items = [mock_item, mock_article] @items[1].expects(:compiled_content).with(:snapshot => :pre).returns('asdf') # Mock site @site = mock @site.stubs(:config).returns({ :base_url => 'http://example.com' }) @@ -389,11 +389,11 @@ end def test_atom_feed_with_title_author_name_and_uri_from_config if_have 'builder' do # Create items - @items = [ mock_item, mock_article ] + @items = [mock_item, mock_article] @items[1].expects(:compiled_content).with(:snapshot => :pre).returns('asdf') # Mock site @config = { :author_name => 'Bob', @@ -417,11 +417,11 @@ end def test_atom_feed_with_articles_param if_have 'builder' do # Mock items - @items = [ mock_article, mock_article ] + @items = [mock_article, mock_article] @items[0].expects(:compiled_content).never @items[1].stubs(:[]).with(:title).returns('Item One') @items[1].expects(:compiled_content).with(:snapshot => :pre).returns('asdf') @@ -435,18 +435,18 @@ @item.stubs(:[]).with(:author_name).returns('J. Doe') @item.stubs(:[]).with(:author_uri).returns('http://example.com/~jdoe') @item.stubs(:[]).with(:[]).with(:feed_url).returns('http://example.com/feed') # Check - atom_feed :articles => [ @items[1] ] + atom_feed :articles => [@items[1]] end end def test_atom_feed_with_limit_param if_have 'builder' do # Mock articles - @items = [ mock_article, mock_article ] + @items = [mock_article, mock_article] @items.each_with_index do |article, i| article.stubs(:[]).with(:title).returns("Article #{i}") article.stubs(:[]).with(:created_at).returns(Time.now - i) end @@ -475,11 +475,11 @@ end def test_atom_feed_sorting if_have 'builder' do # Mock articles - @items = [ mock_article, mock_article ] + @items = [mock_article, mock_article] @items.each_with_index do |article, i| article.stubs(:[]).with(:title).returns("Article #{i}") end @items[0].stubs(:[]).with(:created_at).returns('23-02-2009') @items[1].stubs(:[]).with(:created_at).returns('22-03-2009') @@ -505,11 +505,11 @@ end def test_atom_feed_with_content_proc_param if_have 'builder' do # Mock article - @items = [ mock_article ] + @items = [mock_article] # Mock site @site = mock @site.stubs(:config).returns({ :base_url => 'http://example.com' }) @@ -527,11 +527,11 @@ end def test_atom_feed_with_excerpt_proc_param if_have 'builder' do # Mock article - @items = [ mock_article ] + @items = [mock_article] # Mock site @site = mock @site.stubs(:config).returns({ :base_url => 'http://example.com' }) @@ -549,11 +549,11 @@ end def test_atom_feed_with_icon_param if_have 'builder' do # Mock article - @items = [ mock_article ] + @items = [mock_article] # Mock site @site = mock @site.stubs(:config).returns({ :base_url => 'http://example.com' }) @@ -571,11 +571,11 @@ end def test_atom_feed_with_logo_param if_have 'builder' do # Mock article - @items = [ mock_article ] + @items = [mock_article] # Mock site @site = mock @site.stubs(:config).returns({ :base_url => 'http://example.com' }) @@ -593,11 +593,11 @@ end def test_atom_feed_with_item_without_path if_have 'builder' do # Create items - @items = [ mock_article ] + @items = [mock_article] @items[0].stubs(:path).returns(nil) # Mock site @site = mock @site.stubs(:config).returns({ :base_url => 'http://example.com' }) @@ -607,10 +607,10 @@ @item.stubs(:identifier).returns('/feed/') @item.stubs(:[]).with(:title).returns('My Cool Blog') @item.stubs(:[]).with(:author_name).returns('Denis Defreyne') @item.stubs(:[]).with(:author_uri).returns('http://stoneship.org/') @item.stubs(:[]).with(:feed_url).returns(nil) - @item.stubs(:path).returns("/journal/feed/") + @item.stubs(:path).returns('/journal/feed/') # Check atom_feed end end