From b0164771ec693ff58504ece560371ffec11f9ca9 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Mon, 12 Oct 2015 11:54:46 +0200 Subject: Simplify code around (cross)-references --- spec/support/mentionable_shared_examples.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'spec/support') diff --git a/spec/support/mentionable_shared_examples.rb b/spec/support/mentionable_shared_examples.rb index e3de0afb448..220566a22b6 100644 --- a/spec/support/mentionable_shared_examples.rb +++ b/spec/support/mentionable_shared_examples.rb @@ -65,7 +65,7 @@ shared_examples 'a mentionable' do it "extracts references from its reference property" do # De-duplicate and omit itself - refs = subject.references(project) + refs = subject.referenced_mentionables expect(refs.size).to eq(6) expect(refs).to include(mentioned_issue) expect(refs).to include(mentioned_mr) @@ -84,14 +84,14 @@ shared_examples 'a mentionable' do with(referenced, subject.local_reference, author) end - subject.create_cross_references!(project, author) + subject.create_cross_references! end it 'detects existing cross-references' do SystemNoteService.cross_reference(mentioned_issue, subject.local_reference, author) - expect(subject).to have_mentioned(mentioned_issue) - expect(subject).not_to have_mentioned(mentioned_mr) + expect(subject.cross_reference_exists?(mentioned_issue)).to be_truthy + expect(subject.cross_reference_exists?(mentioned_mr)).to be_falsey end end @@ -143,6 +143,6 @@ shared_examples 'an editable mentionable' do end set_mentionable_text.call(new_text) - subject.create_new_cross_references!(project, author) + subject.create_new_cross_references!(author) end end -- cgit v1.2.1 From 6f35614852a7cf360bbc4af6ba6c450d8667c04e Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Mon, 12 Oct 2015 16:23:15 +0200 Subject: Fix mentionable specs --- spec/support/mentionable_shared_examples.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/support') diff --git a/spec/support/mentionable_shared_examples.rb b/spec/support/mentionable_shared_examples.rb index 220566a22b6..412c6f4ead8 100644 --- a/spec/support/mentionable_shared_examples.rb +++ b/spec/support/mentionable_shared_examples.rb @@ -5,7 +5,7 @@ # - let(:set_mentionable_text) { lambda { |txt| "block that assigns txt to the subject's mentionable_text" } } def common_mentionable_setup - let(:project) { create :project } + let(:project) { subject.project } let(:author) { subject.author } let(:mentioned_issue) { create(:issue, project: project) } -- cgit v1.2.1 From 276b3a7bc202bd9b51c8f5401f4c525227f3a4d8 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Wed, 14 Oct 2015 09:27:30 +0200 Subject: Make Mentionable#cross_reference_exists? private. --- spec/support/mentionable_shared_examples.rb | 7 ------- 1 file changed, 7 deletions(-) (limited to 'spec/support') diff --git a/spec/support/mentionable_shared_examples.rb b/spec/support/mentionable_shared_examples.rb index 412c6f4ead8..f584904845e 100644 --- a/spec/support/mentionable_shared_examples.rb +++ b/spec/support/mentionable_shared_examples.rb @@ -86,13 +86,6 @@ shared_examples 'a mentionable' do subject.create_cross_references! end - - it 'detects existing cross-references' do - SystemNoteService.cross_reference(mentioned_issue, subject.local_reference, author) - - expect(subject.cross_reference_exists?(mentioned_issue)).to be_truthy - expect(subject.cross_reference_exists?(mentioned_mr)).to be_falsey - end end shared_examples 'an editable mentionable' do -- cgit v1.2.1