Skip to content

New cop to disallow before and a single test case #2000

@fatkodima

Description

@fatkodima

It makes little sense to write the test code like

context 'when something' do
  before do
    # some setup
  end

  it 'tests something' do # <--- only one test case
    # some testing
  end
end

The test is now unnecessary segregated. When more before blocks precedes it outside of the context it is even harder to combine all these pieces.

Better is to write it like

context 'when something' do
  it 'tests something' do
    # some setup
    # some testing
  end
end

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