RSpec-specific analysis for your projects, as an extension to RuboCop.
-
Enforce the guidelines and best practices outlined in the community RSpec style guide
-
Simplify the process of adopting new RSpec functionality
Enforcing
expect(calculator.compute(line_item)).to eq(5)
over
calculator.compute(line_item).should == 5
is a feature of RSpec itself – you can read about it in the RSpec Documentation.
Enforcing
RSpec.describe MyClass do
...
end
over
describe MyClass do
...
end
can be achieved using RSpec’s disable_monkey_patching!
method, which you can read more about in the RSpec Documentation. This will also prevent should
from being defined on every object in your system.
Before disabling should
you will need all your specs to use the expect
syntax. You can use Transpec, which will do the conversion for you.