summaryrefslogtreecommitdiff
path: root/spec/models/ci/variable_spec.rb
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-06-29 22:00:57 +0800
committerLin Jen-Shin <godfat@godfat.org>2017-06-29 22:00:57 +0800
commit147939b7fcc233facf5cae41a97aec368a6450df (patch)
tree553401277fd8e44a098cd432c57dc93de34ffcb3 /spec/models/ci/variable_spec.rb
parent42a9eea79186c02f1fdccec886d1202adb33fcf6 (diff)
parentefb7b2d341a63e0904c8e49ab79b51cbbb153221 (diff)
downloadgitlab-ce-147939b7fcc233facf5cae41a97aec368a6450df.tar.gz
Merge remote-tracking branch 'upstream/master' into add-ci_variables-environment_scope
* upstream/master: (192 commits) Minor edits Job details won't scroll horizontally to show long lines Bring back branches badge to main project page Inserts exact matches of username, email and name to the top of the user search list Limit OpenGraph image size to 64x64 Improve changelog Split up MergeRequestsController Add parent_id back to the tests Make changelog more descriptive Update README.md to reflect where "Secret variables" are located Improve tests text Rename members_count to members_count_with_descendants and expose only to group admins Fix a bug where an invalid sort param value was passed to Gitaly Drop default ORDER scope when calling a find method on a Sortable model Add tests for project import state transition: [:started] => [:finished] Add CHANGELOG Perform housekeeping only when an import of a fresh project is completed Strip trailing whitespace in relative submodule URL Adjust projects spec on namespace fields Add "members_count" and "parent_id" data on namespaces API ...
Diffstat (limited to 'spec/models/ci/variable_spec.rb')
-rw-r--r--spec/models/ci/variable_spec.rb33
1 files changed, 1 insertions, 32 deletions
diff --git a/spec/models/ci/variable_spec.rb b/spec/models/ci/variable_spec.rb
index ad3aa660b96..77201c6f419 100644
--- a/spec/models/ci/variable_spec.rb
+++ b/spec/models/ci/variable_spec.rb
@@ -6,6 +6,7 @@ describe Ci::Variable, models: true do
let(:secret_value) { 'secret' }
describe 'validations' do
+ it { is_expected.to include_module(HasVariable) }
it { is_expected.to validate_presence_of(:key) }
it { is_expected.to validate_uniqueness_of(:key).scoped_to(:project_id, :environment_scope) }
it { is_expected.to validate_length_of(:key).is_at_most(255) }
@@ -35,36 +36,4 @@ describe Ci::Variable, models: true do
end
end
end
-
- describe '#value' do
- before do
- subject.value = secret_value
- end
-
- it 'stores the encrypted value' do
- expect(subject.encrypted_value).not_to be_nil
- end
-
- it 'stores an iv for value' do
- expect(subject.encrypted_value_iv).not_to be_nil
- end
-
- it 'stores a salt for value' do
- expect(subject.encrypted_value_salt).not_to be_nil
- end
-
- it 'fails to decrypt if iv is incorrect' do
- subject.encrypted_value_iv = SecureRandom.hex
- subject.instance_variable_set(:@value, nil)
- expect { subject.value }
- .to raise_error(OpenSSL::Cipher::CipherError, 'bad decrypt')
- end
- end
-
- describe '#to_runner_variable' do
- it 'returns a hash for the runner' do
- expect(subject.to_runner_variable)
- .to eq(key: subject.key, value: subject.value, public: false)
- end
- end
end