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

Conversation

tomykaira
Copy link
Contributor

Example:

describe "list" do
  subject(:list) { [1,2,3] }
  describe 'first' do
    subject(:first_element) { list.first }
    it { should eq(1) }
  end
end

With the previous implementation, this fails with "stack level too deep".
This error is not obvious and irritating to me.

I believe this behaviour is more natural.

Example:

    describe "list" do
      subject(:list) { [1,2,3] }
      describe 'first' do
        subject(:first_element) { list.first }
        it { should eq(1) }
      end
    end

With the previous implementation, this fails with "stack level too deep".
This error is not obvious and irritating to me.

I believe this behaviour is more natural.
@travisbot
Copy link

This pull request fails (merged c83eaf9 into f1ef071).

@tomykaira
Copy link
Contributor Author

I think this failure has nothing to do with my patch.

@fukayatsu
Copy link

+1

1 similar comment
@azusa
Copy link

azusa commented Sep 1, 2012

+1

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about subject { send name }?

@tomykaira
Copy link
Contributor Author

@dchelimsky Thanks for good advice. Fixed.

@travisbot
Copy link

This pull request passes (merged b311627 into f1ef071).

dchelimsky added a commit that referenced this pull request Sep 1, 2012
Named subject can be referred from an inside subject block in a nested group
@dchelimsky dchelimsky merged commit 6b286e6 into rspec:master Sep 1, 2012
dchelimsky added a commit that referenced this pull request Sep 1, 2012
@aeg
Copy link

aeg commented Sep 1, 2012

+1

@take
Copy link

take commented May 7, 2013

Aha, thx this really helped 😄

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.

7 participants