-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add format
mailbox
to str
node for Schemacop3 schemas
- Loading branch information
1 parent
178f86f
commit e5e436a
Showing
4 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -191,6 +191,50 @@ def test_format_email | |
assert_cast('[email protected]', '[email protected]') | ||
end | ||
|
||
def test_format_mailbox | ||
schema :string, format: :mailbox | ||
|
||
assert_json(type: :string, format: :mailbox) | ||
|
||
assert_validation '[email protected]' do | ||
error '/', 'String does not match format "mailbox".' | ||
end | ||
|
||
assert_validation '[email protected]' do | ||
error '/', 'String does not match format "mailbox".' | ||
end | ||
|
||
assert_validation '[email protected]' do | ||
error '/', 'String does not match format "mailbox".' | ||
end | ||
|
||
assert_validation 'someemail' do | ||
error '/', 'String does not match format "mailbox".' | ||
end | ||
|
||
assert_validation 'john [email protected]' do | ||
error '/', 'String does not match format "mailbox".' | ||
end | ||
|
||
assert_validation '@[email protected]' do | ||
error '/', 'String does not match format "mailbox".' | ||
end | ||
|
||
assert_validation 'John Doe <[email protected]>' | ||
assert_validation 'John Doe <[email protected]>' | ||
assert_validation 'John Doe <[email protected]>' | ||
|
||
assert_validation 'John <[email protected]>' | ||
assert_validation 'John Doe 123 <[email protected]>' | ||
assert_validation 'John_Doe <[email protected]>' | ||
assert_validation 'John-Doe ÖÄ <[email protected]>' | ||
assert_validation '"John Doe" <[email protected]>' | ||
assert_validation '<[email protected]>' | ||
|
||
assert_cast(nil, nil) | ||
assert_cast('John Doe <[email protected]>', 'John Doe <[email protected]>') | ||
end | ||
|
||
def test_format_boolean | ||
schema :string, format: :boolean | ||
|
||
|