Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/ci/variable_spec.rb')
-rw-r--r--spec/models/ci/variable_spec.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/models/ci/variable_spec.rb b/spec/models/ci/variable_spec.rb
index 26a7a2596af..93a24ba9157 100644
--- a/spec/models/ci/variable_spec.rb
+++ b/spec/models/ci/variable_spec.rb
@@ -14,6 +14,15 @@ RSpec.describe Ci::Variable do
it { is_expected.to validate_uniqueness_of(:key).scoped_to(:project_id, :environment_scope).with_message(/\(\w+\) has already been taken/) }
end
+ describe '.by_environment_scope' do
+ let!(:matching_variable) { create(:ci_variable, environment_scope: 'production ') }
+ let!(:non_matching_variable) { create(:ci_variable, environment_scope: 'staging') }
+
+ subject { Ci::Variable.by_environment_scope('production') }
+
+ it { is_expected.to contain_exactly(matching_variable) }
+ end
+
describe '.unprotected' do
subject { described_class.unprotected }