mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
Merge pull request #69 from gammons/master
use shared_examples_for versioning for posts, topics
This commit is contained in:
commit
36c3467f72
3 changed files with 15 additions and 4 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
Loading…
Reference in a new issue