Skip to content

Commit

Permalink
Test with a String type, otherwise ‘thirtytwo’ gets coerced into nil …
Browse files Browse the repository at this point in the history
…and the format validator is bypassed
  • Loading branch information
stevehodgkiss committed Jan 2, 2015
1 parent 2706417 commit beec60b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test/fixtures.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class FormatValidatorTest
include Lotus::Validations

attribute :name, format: /\A[a-zA-Z]+\z/
attribute :age, type: Integer, format: /\A[0-9]+\z/
attribute :age, type: String, format: /\A[0-9]+\z/
end

class InclusionValidatorTest
Expand Down
2 changes: 1 addition & 1 deletion test/format_validation_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
end

it "is valid if it respects given formats" do
validator = FormatValidatorTest.new({name: 'Luca', age: 32})
validator = FormatValidatorTest.new({name: 'Luca', age: '32'})

validator.valid?.must_equal true
validator.errors.must_be_empty
Expand Down

0 comments on commit beec60b

Please sign in to comment.