From fbbe9f7a19351b37a46db117ba1de082b3e5fb98 Mon Sep 17 00:00:00 2001 From: Sam Saffron Date: Mon, 16 Jun 2014 12:13:28 +1000 Subject: [PATCH] collapse tests to improve perf of suite --- spec/components/post_revisor_spec.rb | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/spec/components/post_revisor_spec.rb b/spec/components/post_revisor_spec.rb index 76dc8ce0e..3be4d4fa2 100644 --- a/spec/components/post_revisor_spec.rb +++ b/spec/components/post_revisor_spec.rb @@ -14,40 +14,25 @@ describe PostRevisor do subject { described_class.new(post) } describe 'with the same body' do - - it 'returns false' do - subject.revise!(post.user, post.raw).should be_false - end - it "doesn't change version" do - lambda { subject.revise!(post.user, post.raw); post.reload }.should_not change(post, :version) + lambda { + subject.revise!(post.user, post.raw).should be_false + post.reload + }.should_not change(post, :version) end - end describe 'ninja editing' do - before do - SiteSetting.expects(:ninja_edit_window).returns(1.minute.to_i) + it 'correctly applies edits' do + SiteSetting.ninja_edit_window = 1.minute.to_i subject.revise!(post.user, 'updated body', revised_at: post.updated_at + 10.seconds) post.reload - end - it 'does not update version' do post.version.should == 1 - end - - it 'does not create a new revision' do post.revisions.size.should == 0 - end - - it "doesn't change the last_version_at" do post.last_version_at.should == first_version_at - end - - it "doesn't update a category" do subject.category_changed.should be_blank end - end describe 'revision much later' do