Sha256: e6bf88682935fafd7deb3b03d97c551784713034ac128f490857e3120ab22d5b
Contents?: true
Size: 915 Bytes
Versions: 7
Compression:
Stored size: 915 Bytes
Contents
require 'spec_helper' describe Post do before :all do Post.delete_all @blog = Blog.make end it 'recognizes its draft status' do @blog.posts.new.draft?.should be_true end it 'returns its path' do @blog.posts.new(:slug => 'foo').path.should == "/#{@blog.title.to_url}/foo" end it 'publishes, setting its publication date' do post = @blog.posts.create(Post.make.attributes) post.publish! post.status.should == 'Published' post.published_at.to_s(:concise).should == Time.zone.now.to_s(:concise) end it 'unpublishes, clearing its publication date' do post = @blog.posts.create(Post.make.attributes) post.publish! post.unpublish! post.status.should == 'Draft' end it 'defaults slug to its title' do post = @blog.posts.new( :title => 'Test Post', :content => 'Bar' ) post.save post.slug.should == 'test-post' end end
Version data entries
7 entries across 7 versions & 1 rubygems