Commit 9cd636ef authored by Sean McGivern's avatar Sean McGivern

Merge branch 'fix-positional-note-specs' into 'master'

Use parent strategy for associations in factories -Positional Note specs

See merge request gitlab-org/gitlab!41373
parents 4270e31c 57439eb5
......@@ -35,7 +35,9 @@ RSpec.describe DiffNote do
subject { create(:diff_note_on_merge_request, project: project, position: position, noteable: merge_request) }
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
describe "#position=" do
......
......@@ -5,11 +5,13 @@ require 'spec_helper'
RSpec.describe DraftNote do
include RepoHelpers
let(:project) { create(:project, :repository) }
let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) }
let_it_be(:project) { create(:project, :repository) }
let_it_be(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) }
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
describe 'delegations' do
......
......@@ -18,8 +18,6 @@ RSpec.shared_examples 'a valid diff positionable note' do |factory_on_commit|
)
end
subject { build(factory_on_commit, commit_id: commit_id, position: position) }
context 'position diff refs matches commit diff refs' do
it 'is valid' do
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