Commit d26e2828 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'fix-specs-to-support-parent-strategy-in-factories-2' into 'master'

Refactor tests to support Parent Strategy in factories

See merge request gitlab-org/gitlab!41754
parents e581fd56 01df877b
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe Ci::Subscriptions::Project do RSpec.describe Ci::Subscriptions::Project do
let(:upstream_project) { create(:project, :public) } let_it_be(:upstream_project) { create(:project, :public) }
let_it_be(:downstream_project) { create(:project) }
describe 'Relations' do describe 'Relations' do
it { is_expected.to belong_to(:downstream_project).required } it { is_expected.to belong_to(:downstream_project).required }
...@@ -11,7 +12,7 @@ RSpec.describe Ci::Subscriptions::Project do ...@@ -11,7 +12,7 @@ RSpec.describe Ci::Subscriptions::Project do
end end
it_behaves_like 'includes Limitable concern' do it_behaves_like 'includes Limitable concern' do
subject { build(:ci_subscriptions_project, upstream_project: upstream_project) } subject { build(:ci_subscriptions_project, upstream_project: upstream_project, downstream_project: downstream_project) }
end end
describe 'Validations' do describe 'Validations' do
......
...@@ -23,7 +23,7 @@ RSpec.describe Geo::Eventable do ...@@ -23,7 +23,7 @@ RSpec.describe Geo::Eventable do
describe '#consumer_klass_name' do describe '#consumer_klass_name' do
it 'returns the even class name without the module part' do it 'returns the even class name without the module part' do
event = build(:geo_repository_created_event) event = build_stubbed(:geo_repository_created_event)
expect(event.consumer_klass_name).to eq 'RepositoryCreatedEvent' expect(event.consumer_klass_name).to eq 'RepositoryCreatedEvent'
end end
......
...@@ -104,6 +104,7 @@ RSpec.describe EE::ProtectedRefAccess do ...@@ -104,6 +104,7 @@ RSpec.describe EE::ProtectedRefAccess do
it "doesn't require access_level if group specified" do it "doesn't require access_level if group specified" do
subject = build(factory_name, access_level: nil, group: create(:group)) subject = build(factory_name, access_level: nil, group: create(:group))
subject.project.save
subject.project.project_group_links.create(group: subject.group) subject.project.project_group_links.create(group: subject.group)
expect(subject).to be_valid expect(subject).to be_valid
......
...@@ -53,7 +53,7 @@ RSpec.describe Geo::EventLog, type: :model do ...@@ -53,7 +53,7 @@ RSpec.describe Geo::EventLog, type: :model do
end end
it 'returns repository_created_event when set' do it 'returns repository_created_event when set' do
repository_created_event = build(:geo_repository_created_event) repository_created_event = build_stubbed(:geo_repository_created_event)
subject.repository_created_event = repository_created_event subject.repository_created_event = repository_created_event
expect(subject.event).to eq repository_created_event expect(subject.event).to eq repository_created_event
......
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