mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-08 18:28:50 +01:00
make custom spec macro `it_should_validate_length_of' accepts a message argument
This commit is contained in:
parent
2672c1e2b7
commit
d62cbf4592
1 changed files with 2 additions and 2 deletions
|
|
@ -18,14 +18,14 @@ module LuckySneaks
|
|||
it "should not be valid if #{attribute} length is more than #{maximum}" do
|
||||
instance.send "#{attribute}=", 'x'*(maximum+1)
|
||||
instance.errors_on(attribute).should include(
|
||||
ActiveRecord::Errors.default_error_messages[:too_long] % maximum
|
||||
options[:message_too_long] || ActiveRecord::Errors.default_error_messages[:too_long] % maximum
|
||||
)
|
||||
end if maximum
|
||||
|
||||
it "should not be valid if #{attribute} length is less than #{minimum}" do
|
||||
instance.send "#{attribute}=", 'x'*(minimum-1)
|
||||
instance.errors_on(attribute).should include(
|
||||
ActiveRecord::Errors.default_error_messages[:too_short] % minimum
|
||||
options[:message_to_short] || ActiveRecord::Errors.default_error_messages[:too_short] % minimum
|
||||
)
|
||||
end if minimum
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue