Fix mentionable specs

This commit is contained in:
Douwe Maan 2015-10-12 16:23:15 +02:00
parent 7a0cc665ff
commit 6f35614852
4 changed files with 6 additions and 7 deletions

View file

@ -89,9 +89,9 @@ eos
end
it_behaves_like 'a mentionable' do
subject { commit }
subject { create(:project).commit }
let(:author) { create(:user, email: commit.author_email) }
let(:author) { create(:user, email: subject.author_email) }
let(:backref_text) { "commit #{subject.id}" }
let(:set_mentionable_text) do
->(txt) { allow(subject).to receive(:safe_message).and_return(txt) }

View file

@ -69,7 +69,7 @@ describe Issue do
end
it_behaves_like 'an editable mentionable' do
subject { create(:issue, project: project) }
subject { create(:issue) }
let(:backref_text) { "issue #{subject.to_reference}" }
let(:set_mentionable_text) { ->(txt){ subject.description = txt } }

View file

@ -192,10 +192,9 @@ describe Note do
end
it_behaves_like 'an editable mentionable' do
subject { create :note, noteable: issue, project: project }
subject { create :note, noteable: issue, project: issue.project }
let(:project) { create(:project) }
let(:issue) { create :issue, project: project }
let(:issue) { create :issue }
let(:backref_text) { issue.gfm_reference }
let(:set_mentionable_text) { ->(txt) { subject.note = txt } }
end

View file

@ -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) }