Adopt specs to the "self cleaning" feature of the attribute groups

pull/5212/head
Wieland Lindenthal 8 years ago committed by Oliver Günther
parent ed70ff52e9
commit a41cc3ba78
No known key found for this signature in database
GPG Key ID: 88872239EB414F99
  1. 16
      spec/models/type_spec.rb

@ -53,6 +53,17 @@ describe ::Type, type: :model do
expect(type.attribute_groups).to_not be_empty
expect(type.attribute_groups).to eq type.default_attribute_groups
end
it 'removes unknown attributes from a group' do
type.attribute_groups = [['foo', ['bar', 'date']]]
expect(type.attribute_groups).to eq [['foo', ['date']]]
end
it 'removes groups without attributes' do
type.attribute_groups = [['foo', []], ['bar', ['date']]]
expect(type.attribute_groups).to eq [['bar', ['date']]]
end
end
describe '#default_attribute_groups' do
@ -97,11 +108,6 @@ describe ::Type, type: :model do
expect(type).not_to be_valid
end
it 'fails validations for unknown attributes' do
type.attribute_groups = [['foo', ['bar']]]
expect(type.save).to be_falsey
end
it 'fails for duplicate group names' do
type.attribute_groups = [['foo', ['date']], ['foo', ['date']]]
expect(type).not_to be_valid

Loading…
Cancel
Save