Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Conversation

TylerRick
Copy link

This appears to be a bug. I would expect this example to pass but it doesn't:

describe 1 do
  # fails with got: "to_s"
  its(:to_s) { should == 1 }
end

@dchelimsky
Copy link
Contributor

Please post the full error message.

@dchelimsky
Copy link
Contributor

Actually, please run with --backtrace and then post the full failure/error message. Thx.

@alindeman
Copy link
Contributor

This is working for me in 2.11. Full backtrace will help.

@travisbot
Copy link

This pull request fails (merged f44cd89 into 07be957).

@TylerRick
Copy link
Author

Sorry for the slow response. Here's the full error message/backtrace: https://gist.github.com/3352348

with its() and named subjects not working the way one would expect.
@travisbot
Copy link

This pull request fails (merged 74ec9d4 into 07be957).

@dchelimsky
Copy link
Contributor

its supports classes only, but you're supplying instances (1 and '1') to describe. The fact that it works sometimes is an accident. You could argue it should work w/ instances, which is a fine argument, however we're going to remove its from rspec-3 (extract to its own gem) so we're not going to do anything to change its behavior now.

As for the issue related to named_subject, that method provides a name you can use to access the subject, but its changes the value of subject. I'm on the fence about making it work any differently in order to support its, but I'm willing to discuss it. If you want to, please open a separate issue (since it is a separate issue).

@dchelimsky dchelimsky closed this Aug 15, 2012
@dchelimsky
Copy link
Contributor

BTW - thank you for providing clear examples of the problem.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants