Greetings,

How to write Example which will check if model's variable's
format is valid using :on => :create, like this:

class User < ActiveRecord::Base
...
 validates_format_of       :email, :with => /.../, :on => :create
...

Using following code is not right:
it "should ..." do
   @user = users(:example_user)
   @user.email = 'invalid_email_format'
   @user.save
   @user.should_not be_valid
end

Even those code is not right:
it "should ... " do
   @user = users(:example_user)
   @user.email = 'invalid_email_format'
   @user.save
   @user.should be_valid
end

Thanks.
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to