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.

let! and subject! ordering #1021

Closed
Closed
@docwhat

Description

@docwhat

It would be nice to have a feature/documentation for the ordering of let! and subject! since it can make a difference.

Personally, I'd prefer they were run last; after all before blocks and before the example.

e.g.

  Scenario: subject bang runs after all before blocks at latest
    Given a file named "subject_bang_last_spec.rb" with:
    """ruby
      describe "subject! runs last" do
        subject! { array.count }
        let(:array) { [] }
        before { array.push 1 }
        describe "nesting group" do
          before { array.push 2 }
          it { should eq(2) }
        end
      end
      """
    When I run `rspec subject_bang_last_spec.rb`
    Then the examples should all pass

It looks like, however, they are run first.

Ciao!

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