I use rspec to test my model . I have with_options statement in my model validation how can I handle it in my test
with_options({on: :some}) do |s|
s.validates :name, presence: true
end
with_options({on: :some2}) do |s2|
s2.validates :name, presence: true
end
It was so easy and it is as usual as other parts when you want to validate your model that has with_options
@myinstance.should_not be_valid(:some)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.