diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 02:18:09 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 02:18:09 +0300 |
commit | 6ed4ec3e0b1340f96b7c043ef51d1b33bbe85fde (patch) | |
tree | dc4d20fe6064752c0bd323187252c77e0a89144b /qa/spec/tools/ci/ff_changes_spec.rb | |
parent | 9868dae7fc0655bd7ce4a6887d4e6d487690eeed (diff) |
Add latest changes from gitlab-org/gitlab@15-4-stable-eev15.4.0-rc42
Diffstat (limited to 'qa/spec/tools/ci/ff_changes_spec.rb')
-rw-r--r-- | qa/spec/tools/ci/ff_changes_spec.rb | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/qa/spec/tools/ci/ff_changes_spec.rb b/qa/spec/tools/ci/ff_changes_spec.rb new file mode 100644 index 00000000000..71ca26867e0 --- /dev/null +++ b/qa/spec/tools/ci/ff_changes_spec.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +RSpec.describe QA::Tools::Ci::FfChanges do + subject(:ff_changes) { described_class.new(mr_diff) } + + before do + allow(Gitlab::QA::TestLogger).to receive(:logger).and_return(Logger.new(StringIO.new)) + end + + context "with merge request pipeline" do + let(:deleted_file) { false } + let(:mr_diff) do + [ + { + path: "config/feature_flags/development/bulk_import_projects.yml", + deleted_file: deleted_file + } + ] + end + + before do + allow(File).to receive(:read) + .with(File.expand_path("../#{mr_diff.first[:path]}", QA::Runtime::Path.qa_root)) + .and_return(File.read("spec/fixtures/ff/bulk_import_projects.yml")) + end + + context "with changed feature flag" do + it "returns inverse ff state option" do + expect(ff_changes.fetch).to eq("bulk_import_projects=enabled") + end + end + + context "with deleted feature flag" do + let(:deleted_file) { true } + + it "returns deleted ff state option" do + expect(ff_changes.fetch).to eq("bulk_import_projects=deleted") + end + end + end + + context "without merge request pipeline" do + let(:mr_diff) { [] } + + context "with empty mr diff" do + it "doesn't return any ff options" do + expect(ff_changes.fetch).to be_nil + end + end + end +end |