From 4e6e634e4a7b5f7e58664455c536134f3afb14eb Mon Sep 17 00:00:00 2001 From: Anton Chuchkalov Date: Mon, 30 Nov 2015 17:56:54 +0400 Subject: [PATCH] update image specs --- devops-service/spec/models/image_spec.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/devops-service/spec/models/image_spec.rb b/devops-service/spec/models/image_spec.rb index be7da26..769e04a 100644 --- a/devops-service/spec/models/image_spec.rb +++ b/devops-service/spec/models/image_spec.rb @@ -16,7 +16,7 @@ RSpec.describe Devops::Model::Image, type: :model do describe 'validation' do include_examples 'field type validation', :id, :not_nil, :non_empty_string, :field_validator - include_examples 'field type validation', :remote_user, :not_nil, :non_empty_string, :only_word_symbols, :field_validator + include_examples 'field type validation', :remote_user, :not_nil, :non_empty_string, :field_validator include_examples 'field type validation', :name, :not_nil, :non_empty_string, :field_validator include_examples 'field type validation', :bootstrap_template, :maybe_nil, :non_empty_string, :only_word_symbols, :field_validator @@ -36,6 +36,12 @@ RSpec.describe Devops::Model::Image, type: :model do it 'bootstrap_template should be included in available bootstrap templates' do expect(build(:image, bootstrap_template: 'wrong')).not_to be_valid end + + it 'remote_user should contain only a-zA-Z0-9_-.' do + expect(build(:image, remote_user: 'aA0-.')).to be_valid + expect(build(:image, remote_user: 'name/')).not_to be_valid + expect(build(:image, remote_user: 'name!')).not_to be_valid + end end it '#to_hash_without_id returns provider, name, remote_user and bootstrap_template' do