Merge pull request #69 from gammons/master

use shared_examples_for versioning for posts, topics
This commit is contained in:
Robin Ward 2013-02-08 08:11:44 -08:00
commit 36c3467f72
3 changed files with 15 additions and 4 deletions

View file

@ -21,6 +21,7 @@ describe Post do
{user: topic.user, topic: topic}
end
it_behaves_like "a versioned model"
describe 'post uniqueness' do
@ -264,10 +265,6 @@ describe Post do
let(:post) { Fabricate(:post, post_args) }
let(:first_version_at) { post.last_version_at }
it 'has an initial version of 1' do
post.cached_version.should == 1
end
it 'has one version in all_versions' do
post.all_versions.size.should == 1
end

View file

@ -23,6 +23,8 @@ describe Topic do
it { should rate_limit }
it_behaves_like "a versioned model"
context '.title_quality' do
it "strips a title when identifying length" do

View file

@ -0,0 +1,12 @@
shared_examples_for "a versioned model" do
let(:model) { Fabricate(described_class.to_s.downcase) }
let(:first_version_at) { model.last_version_at }
it 'should be versioned' do
model.should respond_to(:version)
end
it 'has an initial version of 1' do
model.version.should == 1
end
end