Sha256: afe30eededae3026c40993b29d380833aabecfd08012d86cfec6de05086fe266
Contents?: true
Size: 1.14 KB
Versions: 2
Compression:
Stored size: 1.14 KB
Contents
require "test_helper" describe "Validations" do describe Person do subject { Person } it { must validate_presence_of(:name) } it { must validate_presence_of(:role).with_message("no role") } it { must validate_uniqueness_of(:login).case_insensitive } it { must validate_uniqueness_of(:login).scoped_to(:site) } it { must validate_length_of(:login).in(5..12) } it { must validate_length_of(:login).within(5..12) } it { must validate_length_of(:password).with_min(8) } it { must validate_length_of(:password).with_minimum(8) } it { must validate_length_of(:password).with_max(16) } it { must validate_length_of(:password).with_maximum(16) } it { must validate_format_of(:email).to_allow("foo@bar.com") } it { must validate_format_of(:email).to_not_allow("foo_bar_com") } it { must validate_inclusion_of(:role).to_allow("user", "admin") } it { must validate_exclusion_of(:email).to_not_allow("foo@bar.com", "fizz@buzz.com") } it { must validate_confirmation_of(:password) } it { must validate_acceptance_of(:terms_of_use).accept_with("1") } it { must validate_associated(:pets) } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mongoid-minitest-0.0.3.1 | test/matchers/validations_test.rb |
mongoid-minitest-0.0.3 | test/matchers/validations_test.rb |