Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicit subject block should evaluate at instance level #17

Closed
spohlenz opened this issue Apr 3, 2010 · 2 comments
Closed

Explicit subject block should evaluate at instance level #17

spohlenz opened this issue Apr 3, 2010 · 2 comments

Comments

@spohlenz
Copy link
Contributor

spohlenz commented Apr 3, 2010

It is not currently possible to use a helper method in both the subject block and an it/specify block. e.g.

describe "Foo" do
  def my_helper
    MyClass
  end

  subject { my_helper.new }
  specify { my_helper.should do_something }
end

This code gives undefined method `my_helper' for #Rspec::Core::ExampleGroup... as the subject block is being evaluated in the context of the ExampleGroup class.

If an explicit subject is specified, it should be evaluated in the context of the ExampleGroup instance (this was the case for rspec-1).

@spohlenz
Copy link
Contributor Author

spohlenz commented Apr 3, 2010

@dchelimsky
Copy link
Contributor

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants