Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

ExampleGroup.its(:my_method) should create Example in which subject is modified #22

Closed
gsterndale opened this Issue · 4 comments

2 participants

Greg Sterndale David Chelimsky
Greg Sterndale

Calling subject inside the example_block should return a modified subject.

The first argument to its() should be a symbol representing a method name to be called on subject.

For example, the following should pass:

class Foo
  def bar; 'fizz'; end
end
describe Foo do
  its(:bar) { should == 'fizz' }
end

Accessing the subject in a before or after block should be on the implicit or explicit subject, NOT the modified subject. See https://rspec.lighthouseapp.com/projects/5645/tickets/975-update-to-subject-not-available-to-its

Greg Sterndale

The following commits demonstrate one possible implementation:

http://github.com/gsterndale/rspec-core/commit/a275d813960ffcc82cb7eb255c7ed15401357db7

http://github.com/gsterndale/rspec-core/commit/d4b365ea1b98e533f90aa57ace98ad6651dfcc2b

I'm sternicus on IRC. Hit me up if you'd like me to change anything.

David Chelimsky
Owner

I merged these commits to a branch and made some modifictations:

http://github.com/rspec/rspec-core/tree/32-its

http://github.com/rspec/rspec-core/commit/7a0f51206282d9df00df967e3cebe762e697bd90

Feel free to comment on the commit

Greg Sterndale

Great! I add a couple minor comments in your commit. Thanks.

David Chelimsky
Owner

Closed by c2df11a

Tim Harper timcharper referenced this issue from a commit in timcharper/rspec-core
Greg Sterndale gsterndale ExampleGroup .its() creates new Example with a subject modifier
Closes #22
c2df11a
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.