summaryrefslogtreecommitdiff
path: root/spec/models/concerns/ci
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-03-16 18:18:33 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-03-16 18:18:33 +0000
commitf64a639bcfa1fc2bc89ca7db268f594306edfd7c (patch)
treea2c3c2ebcc3b45e596949db485d6ed18ffaacfa1 /spec/models/concerns/ci
parentbfbc3e0d6583ea1a91f627528bedc3d65ba4b10f (diff)
downloadgitlab-ce-f64a639bcfa1fc2bc89ca7db268f594306edfd7c.tar.gz
Add latest changes from gitlab-org/gitlab@13-10-stable-eev13.10.0-rc40
Diffstat (limited to 'spec/models/concerns/ci')
-rw-r--r--spec/models/concerns/ci/has_variable_spec.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/models/concerns/ci/has_variable_spec.rb b/spec/models/concerns/ci/has_variable_spec.rb
index b5390281064..e917ec6b802 100644
--- a/spec/models/concerns/ci/has_variable_spec.rb
+++ b/spec/models/concerns/ci/has_variable_spec.rb
@@ -11,6 +11,17 @@ RSpec.describe Ci::HasVariable do
it { is_expected.not_to allow_value('foo bar').for(:key) }
it { is_expected.not_to allow_value('foo/bar').for(:key) }
+ describe 'scopes' do
+ describe '.by_key' do
+ let!(:matching_variable) { create(:ci_variable, key: 'example') }
+ let!(:non_matching_variable) { create(:ci_variable, key: 'other') }
+
+ subject { Ci::Variable.by_key('example') }
+
+ it { is_expected.to contain_exactly(matching_variable) }
+ end
+ end
+
describe '#key=' do
context 'when the new key is nil' do
it 'strips leading and trailing whitespaces' do