Created
December 19, 2011 22:44
-
-
Save jimsynz/1499258 to your computer and use it in GitHub Desktop.
WTF!
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
class User | |
include Mongoid::Document | |
field :email | |
validates_format_of :email, :with => /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,6}$/i, :message => "is not a valid email adress." | |
end | |
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
describe User do | |
it { should validate_format_of(:email).to_allow('bot@kimonoapp.com').not_to_allow('b!o^t@kimonoapp.com') } | |
end |
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
3) User | |
Failure/Error: it { should validate_format_of(:email).to_allow('bot@kimonoapp.com').not_to_allow('b!o^t@kimonoapp.com') } | |
Expected User to validate format of "email" allowing the value "bot@kimonoapp.com" and not allowing the value "b!o^t@kimonoapp.com"; instead got "format" validator on "email" with "b!o^t@kimonoapp.com" as a valid value | |
# ./spec/models/user_spec.rb:15:in `__script__' | |
# kernel/common/eval18.rb:43:in `instance_eval' | |
# kernel/bootstrap/array18.rb:16:in `map' | |
# kernel/bootstrap/array18.rb:16:in `map' | |
# kernel/loader.rb:686:in `run_at_exits' | |
# kernel/loader.rb:706:in `epilogue' | |
# kernel/loader.rb:837:in `main' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment