From 0f2f58c42d2664c64be6bc727ef015fbd2f00bfc Mon Sep 17 00:00:00 2001 From: Dan Barber Date: Wed, 5 Jun 2013 10:33:48 +0100 Subject: [PATCH] Fix contact model and spec. --- app/models/contact.rb | 3 +-- spec/models/contact_spec.rb | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/contact.rb b/app/models/contact.rb index 6e4c04b..20f762f 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -11,11 +11,10 @@ class Contact attributes.each do |key, value| self.send("#{key}=", value) end - @attributes = attributes end def read_attribute_for_validation(key) - @attributes[key] + self.send(key) end def save diff --git a/spec/models/contact_spec.rb b/spec/models/contact_spec.rb index fc5c2c6..0800ade 100644 --- a/spec/models/contact_spec.rb +++ b/spec/models/contact_spec.rb @@ -6,4 +6,5 @@ describe Contact do it { should validate_presence_of(:message) } it { should allow_value("test@test.com").for(:email) } + it { should_not allow_value("test@test").for(:email) } end