update image specs

This commit is contained in:
Anton Chuchkalov 2015-11-30 17:56:54 +04:00 committed by Anton Chuchkalov
parent bbb27805a9
commit 4e6e634e4a

View File

@ -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