Skip to content

Commit

Permalink
Better error msg for InvalidDataError
Browse files Browse the repository at this point in the history
  • Loading branch information
ngiger committed Mar 5, 2014
1 parent ef46e97 commit 0a160bb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/sbsm/validator.rb
Expand Up @@ -36,7 +36,7 @@ class InvalidDataError < RuntimeError
attr_reader :key, :value
alias :data :value
def initialize(msg, key, value)
super(msg.to_s)
super("#{msg.to_s} #{key} #{value}")
@key = key
@value = value
end
Expand Down
2 changes: 1 addition & 1 deletion test/test_validator.rb
Expand Up @@ -84,7 +84,7 @@ def test_event
assert_equal(:logout, @val.validate(:event, ['logout']))
end
def test_email1
assert_equal('e_invalid_email_address', @val.validate(:email, 'test').message)
assert_equal('e_invalid_email_address email test', @val.validate(:email, 'test').message)
assert_equal('test@com', @val.validate(:email, 'test@com'))
assert_equal('test@test.com', @val.validate(:email, 'test@test.com'))
assert_equal(SBSM::InvalidDataError, @val.validate(:email, 'test@test@test').class)
Expand Down

0 comments on commit 0a160bb

Please sign in to comment.