diff options
author | Rémy Coutable <remy@rymai.me> | 2016-01-14 12:04:48 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-01-14 12:04:48 +0300 |
commit | e918493f55eb27cdb779f0bc2d8cbbace8b69aa9 (patch) | |
tree | 53aafcde836645b6d96326f696b665182fac6b3c | |
parent | 33ea09bdf9c05c60438f03ac1fe94b52615cd05e (diff) |
Fix specs and rubocop warnings
-rw-r--r-- | features/steps/shared/project.rb | 2 | ||||
-rw-r--r-- | spec/models/note_spec.rb | 4 | ||||
-rw-r--r-- | spec/requests/api/notes_spec.rb | 11 |
3 files changed, 9 insertions, 8 deletions
diff --git a/features/steps/shared/project.rb b/features/steps/shared/project.rb index 5420c451519..d3501b5f5cb 100644 --- a/features/steps/shared/project.rb +++ b/features/steps/shared/project.rb @@ -224,7 +224,7 @@ module SharedProject end def user_owns_project(user_name:, project_name:, visibility: :private) - user = user_exists(user_name, username: user_name.underscore) + user = user_exists(user_name, username: user_name.gsub(/\s/, '').underscore) project = Project.find_by(name: project_name) project ||= create(:empty_project, visibility, name: project_name, namespace: user.namespace) project.team << [user, :master] diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb index 65e6a7df3b4..9182b42661d 100644 --- a/spec/models/note_spec.rb +++ b/spec/models/note_spec.rb @@ -186,12 +186,12 @@ describe Note, models: true do let(:ext_proj) { create(:project, :public) } let(:ext_issue) { create(:issue, project: ext_proj) } - let(:note) { + let(:note) do create :note, noteable: ext_issue, project: ext_proj, note: "mentioned in issue #{private_issue.to_reference(ext_proj)}", system: true - } + end it "returns true" do expect(note.cross_reference_not_visible_for?(ext_issue.author)).to be_truthy diff --git a/spec/requests/api/notes_spec.rb b/spec/requests/api/notes_spec.rb index 565805d870c..d8bbd107269 100644 --- a/spec/requests/api/notes_spec.rb +++ b/spec/requests/api/notes_spec.rb @@ -13,20 +13,21 @@ describe API::API, api: true do # For testing the cross-reference of a private issue in a public issue let(:private_user) { create(:user) } - let(:private_project) { + let(:private_project) do create(:project, namespace: private_user.namespace). tap { |p| p.team << [private_user, :master] } - } - let(:private_issue) { create(:issue, project: private_project) } + end + let(:private_issue) { create(:issue, project: private_project) } + let(:ext_proj) { create(:project, :public) } let(:ext_issue) { create(:issue, project: ext_proj) } - let!(:cross_reference_note) { + let!(:cross_reference_note) do create :note, noteable: ext_issue, project: ext_proj, note: "mentioned in issue #{private_issue.to_reference(ext_proj)}", system: true - } + end before { project.team << [user, :reporter] } |