spec/lib/rubocop/cop/fabricator_shorthand_spec.rb in rubocop-discourse-3.7.0 vs spec/lib/rubocop/cop/fabricator_shorthand_spec.rb in rubocop-discourse-3.7.1
- old
+ new
@@ -29,6 +29,21 @@
RSpec.describe "Foo" do
fab!(:bar) { Fabricate(:foo) }
end
RUBY
end
+
+ it "supports autocorrect" do
+ expect_offense(<<~RUBY)
+ RSpec.describe "Foo" do
+ fab!(:foo) { Fabricate(:foo) }
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Discourse/FabricatorShorthand: Use the fabricator shorthand: `fab!(:foo)`
+ end
+ RUBY
+
+ expect_correction(<<~RUBY)
+ RSpec.describe "Foo" do
+ fab!(:foo)
+ end
+ RUBY
+ end
end