Commit f6fba5f7 authored by Jason Goodman's avatar Jason Goodman

Improve spec performance for feature flag services

Refactor to use let_it_be
parent 1bff8ba9
......@@ -3,12 +3,12 @@
require 'spec_helper'
RSpec.describe FeatureFlags::CreateService do
let(:project) { create(:project) }
let(:developer) { create(:user) }
let(:reporter) { create(:user) }
let_it_be(:project) { create(:project) }
let_it_be(:developer) { create(:user) }
let_it_be(:reporter) { create(:user) }
let(:user) { developer }
before do
before_all do
project.add_developer(developer)
project.add_reporter(reporter)
end
......
......@@ -5,13 +5,13 @@ require 'spec_helper'
RSpec.describe FeatureFlags::DestroyService do
include FeatureFlagHelpers
let(:project) { create(:project) }
let(:developer) { create(:user) }
let(:reporter) { create(:user) }
let_it_be(:project) { create(:project) }
let_it_be(:developer) { create(:user) }
let_it_be(:reporter) { create(:user) }
let(:user) { developer }
let!(:feature_flag) { create(:operations_feature_flag, project: project) }
before do
before_all do
project.add_developer(developer)
project.add_reporter(reporter)
end
......
......@@ -5,12 +5,12 @@ require 'spec_helper'
RSpec.describe FeatureFlags::DisableService do
include FeatureFlagHelpers
let_it_be(:project) { create(:project) }
let_it_be(:user) { create(:user) }
let(:project) { create(:project) }
let(:service) { described_class.new(project, user, params) }
let(:params) { {} }
let(:service) { described_class.new(project, user, params) }
before do
before_all do
project.add_developer(user)
end
......
......@@ -5,12 +5,12 @@ require 'spec_helper'
RSpec.describe FeatureFlags::EnableService do
include FeatureFlagHelpers
let_it_be(:project) { create(:project) }
let_it_be(:user) { create(:user) }
let(:project) { create(:project) }
let(:service) { described_class.new(project, user, params) }
let(:params) { {} }
let(:service) { described_class.new(project, user, params) }
before do
before_all do
project.add_developer(user)
end
......
......@@ -3,13 +3,13 @@
require 'spec_helper'
RSpec.describe FeatureFlags::UpdateService do
let(:project) { create(:project) }
let(:developer) { create(:user) }
let(:reporter) { create(:user) }
let_it_be(:project) { create(:project) }
let_it_be(:developer) { create(:user) }
let_it_be(:reporter) { create(:user) }
let(:user) { developer }
let(:feature_flag) { create(:operations_feature_flag, project: project, active: true) }
before do
before_all do
project.add_developer(developer)
project.add_reporter(reporter)
end
......
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