[rspec-users] Cucumber ".should contain(expected) does but fails anyway

John Goodsen jgoodsen at radsoft.com
Wed Apr 22 20:14:39 EDT 2009


+1.  I like it.

-- 
John Goodsen                 RADSoft / Better Software Faster
jgoodsen at radsoft.com            Lean/Agile/XP/Scrum Coaching and Training
http://www.radsoft.com          Ruby on Rails and Java Solutions

On Wed, Apr 22, 2009 at 4:22 PM, James Byrne <lists at ruby-forum.com> wrote:

> David Chelimsky wrote:
> > On Wed, Apr 22, 2009 at 2:09 PM, James Byrne <lists at ruby-forum.com>
> > wrote:
> >>>> � � � (Spec::Expectations::ExpectationNotMetError)
> >> Rates</title>"
> >> WDYT?
> > I like the idea, though I think it's helpful to also have the strings
> > in the case of String objects. But having the class and object id
> > would really help tell the story we're looking for.
> >
> > wdYt?
>
> After I posted I reconsidered the situation.  When equal? is the
> comparison then the first step should be to check for identical objects
> (duhh). If that fails then do a supplementary == check. If that passes
> then append the ", did you mean '==' notice and display the values
> together with the object.metaclass.  Otherwise, just display the objects
> are different warning and the object.metaclass for each.
>
> However, on reconsideration again, it seems best to skip the second
> check and just display this sort of thing for all equal? failures:
>
>  expected: "#<Class:#<String:0x2b6950315300>> => '<title>Bank of
> Canada: Noon Foreign Exchange Rates</title>'"
>        got: "#<Class:#<String:0x2b695026e898>> => '<title>Bank of
> Canada: Noon Foreign Exchange Rates</title>'"
>
>   (equal?: expected object is not the object returned, did you mean
> '==')
>   (Spec::Expectations::ExpectationNotMetError)
>
> Of course, to support this outside Rails, RSpec will have to provide and
> require the metaclass.rb (shamelessly stolen from Rails).
>
>  unless Object.respond_to? :metaclass do
>    class Object
>      # Get object's meta (ghost, eigenclass, singleton) class
>      def metaclass
>        class << self
>          self
>        end
>      end
>    end
>  end
>
>
>
> Thoughts?
>
>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090422/98b1e554/attachment.html>


More information about the rspec-users mailing list