Hi
I have model Role as
validates_presence_of :name
validates_presence_of :description
validates_format_of :name, :with => /[,]/
And the test to check format as
setup do
@role = Factory(:role) #gives :name=>'role1' description =>
'testdescript'
end
should "validate format of role name" do
assert_valid(@org_role)
end
But when running test get error
test: role should have correct name format. (RoleTest):
ActiveRecord::RecordInvalid: Validation failed: Role name is invalid
But when I comment validates_format_of above everything work ok I cant
figure out where the error is Actually I need role name should not
contain any commas Please help
Thanks in advance
Sijo
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---