spec/posts_archive_spec.rb in awestruct-0.5.4.rc3 vs spec/posts_archive_spec.rb in awestruct-0.5.4
- old
+ new
@@ -52,16 +52,16 @@
end
it "should assign default layout if specified to post without layout" do
extension = Awestruct::Extensions::Posts.new( '/posts', :news, nil, nil, :default_layout => 'blog' )
site = Hashery::OpenCascade[ { :encoding=>false } ]
- page = __create_page( 2012, 8, 9, '/posts/mock-post.md' )
+ page = __create_page( 2012, 8, 9, '/posts/double-post.md' )
page.stub(:layout).and_return(nil)
page.should_receive(:layout=).with('blog')
- page.stub(:slug).and_return(nil, 'mock-post')
- page.should_receive(:slug=).with('mock-post')
- page.should_receive(:output_path=).with('/posts/2012/08/09/mock-post.html')
+ page.stub(:slug).and_return(nil, 'double-post')
+ page.should_receive(:slug=).with('double-post')
+ page.should_receive(:output_path=).with('/posts/2012/08/09/double-post.html')
site.pages = [page]
extension.execute(site)
site.news.size.should == 1
site.news.first.should == page
@@ -79,21 +79,21 @@
@archive.posts[2012].should_not be_nil
@archive.posts[2012][8][9][0].should == @page
end
it "should use the provided template when generating the archive" do
- engine = mock("Engine")
- template = mock("Template")
+ engine = double("Engine")
+ template = double("Template")
template.should_receive( :archive= ).with( @archive.posts[2012][8][9] )
template.should_receive( :output_path= ).with( '/archive/2012/8/9/index.html' )
engine.should_receive( :find_and_load_site_page ).with( '/archive/index' ).and_return( template )
@archive.generate_pages( engine, '/archive/index', '/archive' )
end
end
def __create_page(year, month, day, path = nil)
- page = mock( "Page for #{year}-#{month}-#{day}" )
+ page = double( "Page for #{year}-#{month}-#{day}" )
page.stub(:date?).and_return( true )
page.stub(:date=).with(anything())
page.stub_chain(:date, :year).and_return( year )
page.stub_chain(:date, :month).and_return( month )
page.stub_chain(:date, :day).and_return( day )