bcardarella / valid_attribute

Minimalist validation BDD for ActiveModel specs
178 stars 18 forks source link

What happened to the .message chained method? #12

Closed millisami closed 13 years ago

millisami commented 13 years ago

Earlier, the following spec used to pass.

it { should_not have_valid(:email).when('1wey', '1234@').message('is invalid') }

But since the upgraded version, its showing the error.

NoMethodError:
       undefined method `message' for #<ValidAttribute::Matcher:0x00000102f119d8>

I really liked that method coz it gives me the way to test the custom message at the same time? Is it deprecated or replaced with other method? I couldn't find any in the README too.

bcardarella commented 13 years ago

#message was removed from the pre-1.0 release as it doesn't test anything functional.

In addition, if you are testing multiple values on a single attribute like this:

before { User.create(:email => 'taken@test.com') }
it { should_not have_valid(:email).with(nil, '', 'test', 'taken@test.com') }

ValidAttribute is testing at least three difference validators here: presence, format and uniqueness each with different messages.

millisami commented 13 years ago

Alright. Thanks for the explanation. Keep Up the great work!