Open ryanzidago opened 5 years ago
Unsubscribe
On Sun, Jul 21, 2019, 11:09 AM Ryan Zidago notifications@github.com wrote:
Wouldn't it be clearer to get rid of the following line of code:
it { is_expected.to validate_presence_of(:url) }
in validations_and_associations.md https://github.com/thoughtbot/testing-rails/blob/master/book/types_of_tests/model_specs/validations_and_associations.md since urls are not expected to be unique (see link_spec.rb https://github.com/thoughtbot/testing-rails/blob/master/example_app/spec/models/link_spec.rb )?
I went on to add the corresponding code for validating the uniqueness of urls before realizing the urls do not need to be unique and uniqueness of urls are not implemented in the example_app.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/thoughtbot/testing-rails/issues/99?email_source=notifications&email_token=AAAEI3T343LKQ6ELLKSENA3QAQRTFA5CNFSM4IFRRTV2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HAPHJEA, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAEI3QM4EDXUKVWEWV4WMTQAQRTFANCNFSM4IFRRTVQ .
@ryanzidago if this line is removed, a blank value (empty , " ") will be accepted if is unique.
@ryanzidago if this line is removed, a blank value (empty , " ") will be accepted if is unique.
How come? The presence: true
prevents nils and empty strings from being accepted.
Wouldn't it be clearer to get rid of the following line of code:
it { is_expected.to validate_uniqueness_of(:url) }
in validations_and_associations.md, since urls are not expected to be unique (see link_spec.rb)?
I went on to add the corresponding code for validating the uniqueness of urls before realizing the urls do not need to be unique and uniqueness of urls are not implemented in the example_app.