[rspec-users] rspec causing validates_presence_of to validate twice?

David Chelimsky dchelimsky at gmail.com
Wed Oct 17 19:01:11 EDT 2007


On 10/17/07, Steve <vertebrate at gmail.com> wrote:
> On Wed, 17 Oct 2007 16:40:11 -0500, David Chelimsky wrote:
> >
> > Would you please try running it like this:
> >
> > script/spec spec -b
> >
> > and this
> >
> > script/spec spec/models/user_spec.rb -b
> >
> > and let us know if it's still happening?
>
> script/spec spec -b changes things. It doesn't give that duplication of
> validations for password presence, but does it on two other tests(which
> pass using rake spec:models):
>
> 1)
> 'User with a new password should check that the password is 6-15 characters long' FAILED
> expected: "is too short (minimum is 6 characters)",
>      got: ["is too short (minimum is 6 characters)", "is too short (minimum is 6 characters)"] (using ==)
> /trunk/vendor/plugins/rspec/lib/spec/expectations.rb:52:in `fail_with'
> /trunk/vendor/plugins/rspec/lib/spec/matchers/operator_matcher.rb:46:in `fail_with_message'
> /trunk/vendor/plugins/rspec/lib/spec/matchers/operator_matcher.rb:56:in `__delegate_method_missing_to_target'
> /trunk/vendor/plugins/rspec/lib/spec/matchers/operator_matcher.rb:12:in `=='
> /trunk/spec/models/user_spec.rb:138:
> /trunk/vendor/plugins/rspec/lib/spec/dsl/example_module.rb:171:in `instance_eval'
> /trunk/vendor/plugins/rspec/lib/spec/dsl/example_module.rb:171:in `run_example'
> /trunk/vendor/plugins/rspec/lib/spec/dsl/example_runner.rb:65:in `run_example'
> /trunk/vendor/plugins/rspec/lib/spec/dsl/example_runner.rb:26:in `run'
> /usr/lib/ruby/1.8/timeout.rb:48:in `timeout'
> /trunk/vendor/plugins/rspec/lib/spec/dsl/example_runner.rb:24:in `run'
> /trunk/vendor/plugins/rspec/lib/spec/dsl/example_suite.rb:26:in `rspec_run'
> /trunk/vendor/plugins/rspec/lib/spec/dsl/example_suite.rb:22:in `each'
> /trunk/vendor/plugins/rspec/lib/spec/dsl/example_suite.rb:22:in `rspec_run'
> /trunk/vendor/plugins/rspec/lib/spec/test/unit/example_suite.rb:7:in `run'
> /trunk/vendor/plugins/rspec/lib/spec/runner/behaviour_runner.rb:12:in `run'
> /trunk/vendor/plugins/rspec/lib/spec/runner/behaviour_runner.rb:11:in `each'
> /trunk/vendor/plugins/rspec/lib/spec/runner/behaviour_runner.rb:11:in `run'
> /trunk/vendor/plugins/rspec/lib/spec/runner/options.rb:71:in `run_examples'
> /trunk/vendor/plugins/rspec/lib/spec/runner/command_line.rb:22:in `run'
> script/spec:4:
>
> 2)
> 'User with a new password should check for confirmation of the new password' FAILED
> expected: "doesn't match confirmation",
>      got: ["doesn't match confirmation", "doesn't match confirmation"] (using ==)
> /trunk/vendor/plugins/rspec/lib/spec/expectations.rb:52:in `fail_with'
> /trunk/vendor/plugins/rspec/lib/spec/matchers/operator_matcher.rb:46:in `fail_with_message'
> /trunk/vendor/plugins/rspec/lib/spec/matchers/operator_matcher.rb:56:in `__delegate_method_missing_to_target'
> /trunk/vendor/plugins/rspec/lib/spec/matchers/operator_matcher.rb:12:in `=='
> /trunk/spec/models/user_spec.rb:154:
> /trunk/vendor/plugins/rspec/lib/spec/dsl/example_module.rb:171:in `instance_eval'
> /trunk/vendor/plugins/rspec/lib/spec/dsl/example_module.rb:171:in `run_example'
> /trunk/vendor/plugins/rspec/lib/spec/dsl/example_runner.rb:65:in `run_example'
> /trunk/vendor/plugins/rspec/lib/spec/dsl/example_runner.rb:26:in `run'
> /usr/lib/ruby/1.8/timeout.rb:48:in `timeout'
> /trunk/vendor/plugins/rspec/lib/spec/dsl/example_runner.rb:24:in `run'
> /trunk/vendor/plugins/rspec/lib/spec/dsl/example_suite.rb:26:in `rspec_run'
> /trunk/vendor/plugins/rspec/lib/spec/dsl/example_suite.rb:22:in `each'
> /trunk/vendor/plugins/rspec/lib/spec/dsl/example_suite.rb:22:in `rspec_run'
> /trunk/vendor/plugins/rspec/lib/spec/test/unit/example_suite.rb:7:in `run'
> /trunk/vendor/plugins/rspec/lib/spec/runner/behaviour_runner.rb:12:in `run'
> /trunk/vendor/plugins/rspec/lib/spec/runner/behaviour_runner.rb:11:in `each'
> /trunk/vendor/plugins/rspec/lib/spec/runner/behaviour_runner.rb:11:in `run'
> /trunk/vendor/plugins/rspec/lib/spec/runner/options.rb:71:in `run_examples'
> /trunk/vendor/plugins/rspec/lib/spec/runner/command_line.rb:22:in `run'
> script/spec:4:
>
> script/spec spec/models/user_spec.rb -b yields the same as above.

One more thing to try. Open up spec/spec.opts and remove the line that
says "--reverse" if it's there. Then run "rake spec" again and see
what happens.

Thanks,
David


More information about the rspec-users mailing list