Commit 57439eb5 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu Committed by Eugenia Grieff

Fix positional note specs

These specs needed a persisted project and merge request
parent 0422c4a6
...@@ -35,7 +35,9 @@ RSpec.describe DiffNote do ...@@ -35,7 +35,9 @@ RSpec.describe DiffNote do
subject { create(:diff_note_on_merge_request, project: project, position: position, noteable: merge_request) } subject { create(:diff_note_on_merge_request, project: project, position: position, noteable: merge_request) }
describe 'validations' do describe 'validations' do
it_behaves_like 'a valid diff positionable note', :diff_note_on_commit it_behaves_like 'a valid diff positionable note' do
subject { build(:diff_note_on_commit, project: project, commit_id: commit_id, position: position) }
end
end end
describe "#position=" do describe "#position=" do
......
...@@ -5,11 +5,13 @@ require 'spec_helper' ...@@ -5,11 +5,13 @@ require 'spec_helper'
RSpec.describe DraftNote do RSpec.describe DraftNote do
include RepoHelpers include RepoHelpers
let(:project) { create(:project, :repository) } let_it_be(:project) { create(:project, :repository) }
let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) } let_it_be(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) }
describe 'validations' do describe 'validations' do
it_behaves_like 'a valid diff positionable note', :draft_note it_behaves_like 'a valid diff positionable note' do
subject { build(:draft_note, merge_request: merge_request, commit_id: commit_id, position: position) }
end
end end
describe 'delegations' do describe 'delegations' do
......
...@@ -18,8 +18,6 @@ RSpec.shared_examples 'a valid diff positionable note' do |factory_on_commit| ...@@ -18,8 +18,6 @@ RSpec.shared_examples 'a valid diff positionable note' do |factory_on_commit|
) )
end end
subject { build(factory_on_commit, commit_id: commit_id, position: position) }
context 'position diff refs matches commit diff refs' do context 'position diff refs matches commit diff refs' do
it 'is valid' do it 'is valid' do
expect(subject).to be_valid expect(subject).to be_valid
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment