Commit 84f9c5c7 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch 'jh-use-non-persisted-subject-merge-requests' into 'master'

Avoid persisting subject for faster MR association tests

See merge request gitlab-org/gitlab!35985
parents 18ec84cd 4b295bcb
...@@ -16,6 +16,8 @@ RSpec.describe MergeRequest do ...@@ -16,6 +16,8 @@ RSpec.describe MergeRequest do
subject(:merge_request) { create(:merge_request, source_project: project, target_project: project) } subject(:merge_request) { create(:merge_request, source_project: project, target_project: project) }
describe 'associations' do describe 'associations' do
subject { build_stubbed(:merge_request) }
it { is_expected.to have_many(:approvals).dependent(:delete_all) } it { is_expected.to have_many(:approvals).dependent(:delete_all) }
it { is_expected.to have_many(:approvers).dependent(:delete_all) } it { is_expected.to have_many(:approvers).dependent(:delete_all) }
it { is_expected.to have_many(:approver_users).through(:approvers) } it { is_expected.to have_many(:approver_users).through(:approvers) }
......
...@@ -12,6 +12,8 @@ RSpec.describe MergeRequest do ...@@ -12,6 +12,8 @@ RSpec.describe MergeRequest do
subject { create(:merge_request) } subject { create(:merge_request) }
describe 'associations' do describe 'associations' do
subject { build_stubbed(:merge_request) }
it { is_expected.to belong_to(:target_project).class_name('Project') } it { is_expected.to belong_to(:target_project).class_name('Project') }
it { is_expected.to belong_to(:source_project).class_name('Project') } it { is_expected.to belong_to(:source_project).class_name('Project') }
it { is_expected.to belong_to(:merge_user).class_name("User") } it { is_expected.to belong_to(:merge_user).class_name("User") }
......
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