diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-05 15:12:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-05 15:12:58 +0300 |
commit | c9b0dfef1ba43a9e04264023b08c589bcb9eb397 (patch) | |
tree | 4ea24fc43fe40e3c133e64e2476e0be42dafc10b /spec/helpers | |
parent | e0c90aab261896abcf93f3806d965790dbd03408 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/helpers')
-rw-r--r-- | spec/helpers/feature_flags_helper_spec.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/helpers/feature_flags_helper_spec.rb b/spec/helpers/feature_flags_helper_spec.rb index 9a080736595..228459277ca 100644 --- a/spec/helpers/feature_flags_helper_spec.rb +++ b/spec/helpers/feature_flags_helper_spec.rb @@ -3,10 +3,20 @@ require 'spec_helper' RSpec.describe FeatureFlagsHelper do + include Devise::Test::ControllerHelpers + let_it_be(:project) { create(:project) } let_it_be(:feature_flag) { create(:operations_feature_flag, project: project) } let_it_be(:user) { create(:user) } + before do + allow(helper).to receive(:can?).and_return(true) + allow(helper).to receive(:current_user).and_return(user) + + self.instance_variable_set(:@project, project) + self.instance_variable_set(:@feature_flag, feature_flag) + end + describe '#unleash_api_url' do subject { helper.unleash_api_url(project) } @@ -18,4 +28,17 @@ RSpec.describe FeatureFlagsHelper do it { is_expected.not_to be_empty } end + + describe '#edit_feature_flag_data' do + subject { helper.edit_feature_flag_data } + + it 'contains all the data needed to edit feature flags' do + is_expected.to include(endpoint: "/#{project.full_path}/-/feature_flags/#{feature_flag.iid}", + project_id: project.id, + feature_flags_path: "/#{project.full_path}/-/feature_flags", + environments_endpoint: "/#{project.full_path}/-/environments/search.json", + strategy_type_docs_page_path: "/help/operations/feature_flags#feature-flag-strategies", + environments_scope_docs_path: "/help/ci/environments/index.md#scope-environments-with-specs") + end + end end |