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

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

Closed
gsterndale opened this issue Apr 17, 2010 · 4 comments

Comments

@gsterndale
Copy link
Contributor

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

@gsterndale
Copy link
Contributor Author

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.

@dchelimsky
Copy link
Contributor

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

@gsterndale
Copy link
Contributor Author

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

@dchelimsky
Copy link
Contributor

Closed by c2df11a

timcharper pushed a commit to timcharper/rspec-core that referenced this issue Aug 19, 2011
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