Skip to content

Describe more use cases of 'subject' in RSpec #128

@holywyvern

Description

@holywyvern

In the Slack channel of #ruby-rails-basics we were discussing about the use case of subject in RSpec tests.

In the tech guide about subject, it recommends using it when you are creating an instance of the described class.

As some people check out, they also recommend to use subject when describing an element we are currently testing witch makes sense.

To be more clear, when a controller is being tested, and we make a request, our subject should be request instead of an instance of the controller.

It probably is a really basic thing to clarify, but it may be helpful to specify that to avoid confusion.

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