diff options
author | Jeroen van Baarsen <jeroenvanbaarsen@gmail.com> | 2015-02-12 19:17:35 +0100 |
---|---|---|
committer | Jeroen van Baarsen <jeroenvanbaarsen@gmail.com> | 2015-02-12 19:17:35 +0100 |
commit | 0c4a70a306b871899bf87ce4673918abfee4d95f (patch) | |
tree | c7a702fb511209ffe0eceba245d1ffea71dce1aa /spec/support/mentionable_shared_examples.rb | |
parent | de1c450abd6b367390a1295cac402344f500d41d (diff) | |
download | gitlab-ce-0c4a70a306b871899bf87ce4673918abfee4d95f.tar.gz |
Updated rspec to rspec 3.x syntax
Signed-off-by: Jeroen van Baarsen <jeroenvanbaarsen@gmail.com>
Diffstat (limited to 'spec/support/mentionable_shared_examples.rb')
-rw-r--r-- | spec/support/mentionable_shared_examples.rb | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/spec/support/mentionable_shared_examples.rb b/spec/support/mentionable_shared_examples.rb index ebd74206699..305592fa5a6 100644 --- a/spec/support/mentionable_shared_examples.rb +++ b/spec/support/mentionable_shared_examples.rb @@ -39,7 +39,7 @@ def common_mentionable_setup # unrecognized commits. commitmap = { '1234567890a' => mentioned_commit } extra_commits.each { |c| commitmap[c.short_id] = c } - mproject.repository.stub(:commit) { |sha| commitmap[sha] } + allow(mproject.repository).to receive(:commit) { |sha| commitmap[sha] } set_mentionable_text.call(ref_string) end end @@ -48,19 +48,19 @@ shared_examples 'a mentionable' do common_mentionable_setup it 'generates a descriptive back-reference' do - subject.gfm_reference.should == backref_text + expect(subject.gfm_reference).to eq(backref_text) end it "extracts references from its reference property" do # De-duplicate and omit itself refs = subject.references(mproject) - refs.should have(6).items - refs.should include(mentioned_issue) - refs.should include(mentioned_mr) - refs.should include(mentioned_commit) - refs.should include(ext_issue) - refs.should include(ext_mr) - refs.should include(ext_commit) + expect(refs.size).to eq(6) + expect(refs).to include(mentioned_issue) + expect(refs).to include(mentioned_mr) + expect(refs).to include(mentioned_commit) + expect(refs).to include(ext_issue) + expect(refs).to include(ext_mr) + expect(refs).to include(ext_commit) end it 'creates cross-reference notes' do @@ -68,7 +68,7 @@ shared_examples 'a mentionable' do ext_issue, ext_mr, ext_commit] mentioned_objects.each do |referenced| - Note.should_receive(:create_cross_reference_note).with(referenced, subject.local_reference, mauthor, mproject) + expect(Note).to receive(:create_cross_reference_note).with(referenced, subject.local_reference, mauthor, mproject) end subject.create_cross_references!(mproject, mauthor) @@ -77,8 +77,8 @@ shared_examples 'a mentionable' do it 'detects existing cross-references' do Note.create_cross_reference_note(mentioned_issue, subject.local_reference, mauthor, mproject) - subject.has_mentioned?(mentioned_issue).should be_true - subject.has_mentioned?(mentioned_mr).should be_false + expect(subject.has_mentioned?(mentioned_issue)).to be_truthy + expect(subject.has_mentioned?(mentioned_mr)).to be_falsey end end @@ -95,12 +95,12 @@ shared_examples 'an editable mentionable' do "#{ext_proj.path_with_namespace}##{other_ext_issue.iid}" [mentioned_issue, mentioned_commit, ext_issue].each do |oldref| - Note.should_not_receive(:create_cross_reference_note).with(oldref, subject.local_reference, + expect(Note).not_to receive(:create_cross_reference_note).with(oldref, subject.local_reference, mauthor, mproject) end [other_issue, other_ext_issue].each do |newref| - Note.should_receive(:create_cross_reference_note).with( + expect(Note).to receive(:create_cross_reference_note).with( newref, subject.local_reference, mauthor, |