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

Explicit subject block should evaluate at instance level #17

@spohlenz

Description

@spohlenz

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions