Spec Date Rails 4 -


i want add birthday date user model, how implemented it:

user.rb

validates_date :birthday_date 

user_spec.rb

describe user  before(:each) @attr = {   :birthday_date =>  date.new(1992, 8, 27),   :nom => "utilisateur",   :email => "user@example.com",   :password => "foobar",   :password_confirmation => "foobar" } end  "..."  user.create!(@attr) end  "must have correct date"   bad_guy = user.new(@attr.merge(:birthday_date => ""))   bad_guy.should_not be_valid end 

but when want test it, have got error :

failure/error: @follower = factory(:user)  activerecord::recordinvalid:    validation failed: birthday date not valid date 

why date not accepted?


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -