Skip to content
RuboCop extension to find focused specs
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib/rubocop Cut v1.0.0. Nov 27, 2017
spec
vendor
.gitignore
.gitmodules
.rspec
.travis.yml
CHANGELOG.md
Gemfile
LICENSE.txt
README.md
Rakefile
rubocop-rspec-focused.gemspec

README.md

rubocop-rspec-focused

Build Status

RuboCop lint for focused specs.

Note: This functionality has also been implemented in the more general rubocop-rspec gem (as RSpec/Focus).

This gem finds focus: true and the following method calls:

  • focus
  • fexample
  • fit
  • fspecify
  • fcontext
  • fdescribe
# bad
fit 'does something' do
  expect(foo).to be_empty
end

fdescribe Something do
  it 'does something' do
    expect(foo).to be_empty
  end
end

specify 'does something', focus: true do
  expect(foo).to be_empty
end

specify 'does something', :focus do
  expect(foo).to be_empty
end

# good
it 'does something' do
  expect(foo).to be_empty
end

describe Something do
  it 'does something' do
    expect(foo).to be_empty
  end
end

specify 'does something' do
  expect(foo).to be_empty
end

Installation

Add this line to your application's Gemfile:

gem 'rubocop-rspec-focused', require: false

And then execute:

$ bundle

And add this to your .rubocop.yml:

require:
  - rubocop/rspec/focused

RSpec/Focused:
  Enabled: true

Contributing

  1. Fork it ( https://github.com/lovewithfood/rubocop-rspec-focused/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

For running the spec files, this project depends on RuboCop's spec helpers. This means that in order to run the specs locally, you need a (shallow) clone of the RuboCop repository:

git submodule update --init vendor/rubocop
You can’t perform that action at this time.