diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-16 21:07:22 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-16 21:07:22 +0000 |
commit | e924e9e7cb9df21b3bc3d51d5f955da28ba3a225 (patch) | |
tree | 598ccb6f09e55ad06e628a90d27628f20ae693fe /spec/models/aws | |
parent | 8e45d25f7dde6508839ffee719c0ddc2cf6b12d3 (diff) | |
download | gitlab-ce-e924e9e7cb9df21b3bc3d51d5f955da28ba3a225.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/aws')
-rw-r--r-- | spec/models/aws/role_spec.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/models/aws/role_spec.rb b/spec/models/aws/role_spec.rb new file mode 100644 index 00000000000..c40752e40a6 --- /dev/null +++ b/spec/models/aws/role_spec.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe Aws::Role do + it { is_expected.to belong_to(:user) } + it { is_expected.to validate_length_of(:role_external_id).is_at_least(1).is_at_most(64) } + + describe 'custom validations' do + subject { role.valid? } + + context ':role_arn' do + let(:role) { build(:aws_role, role_arn: role_arn) } + + context 'length is zero' do + let(:role_arn) { '' } + + it { is_expected.to be_falsey } + end + + context 'length is longer than 2048' do + let(:role_arn) { '1' * 2049 } + + it { is_expected.to be_falsey } + end + + context 'ARN is valid' do + let(:role_arn) { 'arn:aws:iam::123456789012:role/test-role' } + + it { is_expected.to be_truthy } + end + end + end +end |