There''s another quirk I wanted to bring up. It''s about the failure message with should_equal and should_be. x.should_equal 2 a.should_not_be nil When they fail they yield messages like: 1 should equal 2 nil should not be nil When I''m caught off guard, which can be often, these messages confuse me. 1 should equal 2? No it shouldn''t. nil should not be nil? But they are the same! You get my drift? When taken out side the context of a specification, these statements are just absurd. In my humble opinion, these messages should include their context and read like this: x should equal 2 but was 1 a should not be nil but was nil I realize there might be an issue printing the expression that gets evaluated, but you guys have done some cool magic to this point. Have you got a bit more up your sleeves? Micah Martin 8th Light, Inc. www.8thlight.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20061024/21a37e7b/attachment.html
Can you please submit an RFE on this one? http://rubyforge.org/tracker/?group_id=797 Thanks, David On 10/24/06, Micah Martin <micah at 8thlight.com> wrote:> > There''s another quirk I wanted to bring up. It''s about the failure message > with should_equal and should_be. > > x.should_equal 2 > a.should_not_be nil > > When they fail they yield messages like: > > 1 should equal 2 > nil should not be nil > > When I''m caught off guard, which can be often, these messages confuse me. 1 > should equal 2? No it shouldn''t. nil should not be nil? But they are the > same! > You get my drift? When taken out side the context of a specification, these > statements are just absurd. > > In my humble opinion, these messages should include their context and read > like this: > > x should equal 2 but was 1 > a should not be nil but was nil > > I realize there might be an issue printing the expression that gets > evaluated, but you guys have done some cool magic to this point. Have you > got a bit more up your sleeves? > > Micah Martin > 8th Light, Inc. > www.8thlight.com > > > > > _______________________________________________ > Rspec-users mailing list > Rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > >
On 10/24/06, David Chelimsky <dchelimsky at gmail.com> wrote:> Can you please submit an RFE on this one? > > http://rubyforge.org/tracker/?group_id=797 > > Thanks, > David > > On 10/24/06, Micah Martin <micah at 8thlight.com> wrote: > > > > There''s another quirk I wanted to bring up. It''s about the failure message > > with should_equal and should_be. > > > > x.should_equal 2 > > a.should_not_be nil > > > > When they fail they yield messages like: > >The simple solution would be:> > 1 should equal 21 (actual value) should equal 2 (expected value)> > nil should not be nil > > > > When I''m caught off guard, which can be often, these messages confuse me. 1 > > should equal 2? No it shouldn''t. nil should not be nil? But they are the > > same! > > You get my drift? When taken out side the context of a specification, these > > statements are just absurd. > > > > In my humble opinion, these messages should include their context and read > > like this: > > > > x should equal 2 but was 1 > > a should not be nil but was nil > > > > I realize there might be an issue printing the expression that gets > > evaluated, but you guys have done some cool magic to this point. Have you > > got a bit more up your sleeves? > >I''ll pick up the glove on this. It will be a fun exercise in parsing the source file to extract the variable names. We have all the info available (file, line number) in the stack trace. Could you file an RFE in the form of failing specs expressing what you want the error message to be? Hint: lambda do x = 1 x.should_equal 2 end.should_raise(ExpectationNotMetError, "x should equal 2 but was 1") -enough to cover all the cases you can think of? Aslak> > Micah Martin > > 8th Light, Inc. > > www.8thlight.com > > > > > > > > > > _______________________________________________ > > Rspec-users mailing list > > Rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > > > _______________________________________________ > Rspec-users mailing list > Rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >