spec/attribute_spec.rb in katapult-0.1.2 vs spec/attribute_spec.rb in katapult-0.2.0
- old
+ new
@@ -30,9 +30,22 @@
"Attribute type :undefined is not supported. Use one of #{Katapult::Attribute::TYPES.inspect}."
)
end
end
+ describe 'password attributes' do
+ it 'recognizes password attributes' do
+ expect(described_class.new('password').type).to eql(:password)
+ expect(described_class.new('encrypted_password').type).to eql(:password)
+ expect(described_class.new('name').type).to_not eql(:password)
+ end
+
+ it 'does not overwrite a given type' do
+ expect(described_class.new('password', type: :string).type).to eql(:string)
+ expect(described_class.new('password_updated_at', type: :datetime).type).to eql(:datetime)
+ end
+ end
+
describe 'email attributes' do
it 'recognizes email attributes' do
expect(described_class.new('email').type).to eql(:email)
expect(described_class.new('customer_email').type).to eql(:email)
expect(described_class.new('name').type).to_not eql(:email)