[rspec-users] Cucumber - RSpec matcher

aslak hellesoy aslak.hellesoy at gmail.com
Mon Mar 9 13:52:33 EDT 2009


On Mon, Mar 9, 2009 at 6:18 PM, James Byrne <lists at ruby-forum.com> wrote:

> I must be missing something obvious here but I cannot seem to see it.
>
> I have this step definition:
>
> When /entity named "(.*)" has a legal name "(.*)"/ do |name, legal|
>  myentity = Entity.find_by_entity_common_name!(name.hll_keycase)
>  myentity.entity_legal_name.should equal legal.hll_keycase
> end
>
> Which fails with this:
>
>    And the entity named "Myuser" has a legal name "Myuser Legal Name"
> # features/app/models/entities/step_definitions/entity_steps.rb:20
>      expected #<ActiveSupport::Multibyte::Chars:0x2b4bb29e73d8
> @wrapped_string="myuser legal name">, got "myuser legal name" (using
> .equal?)
>

Looks like you're expecting an instance of ActiveSupport::Multibyte::Chars,
but actually got an instance of String.

I'm not familiar with the ActiveSupport::Multibyte::Chars API, but as a
general rule, two object won't be #equal? unless they have the same type.

Aslak


>
> which to me says that I got what I expected (myuser legal name) but
> which fails the equality test nonetheless.
>
> However, if I switch the test to this:
>
>  assert_equal(myentity.entity_legal_name,legal.hll_keycase)
>
> Then the step definition passes.
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>



-- 
Aslak (::)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090309/3c5e5f22/attachment.html>


More information about the rspec-users mailing list