Sha256: 8b02c27b1bca8712489e8e697713562f3f6f286bd407ef3cc87095b335688496
Contents?: true
Size: 928 Bytes
Versions: 1
Compression:
Stored size: 928 Bytes
Contents
# frozen_string_literal: true require "spec_helper" describe RuboCop::Cop::Discourse::FabricatorShorthand, :config do subject(:cop) { described_class.new(config) } let(:config) { RuboCop::Config.new } it "registers an offense when not using the fabricator shorthand" do expect_offense(<<~RUBY) RSpec.describe "Foo" do fab!(:foo) { Fabricate(:foo) } ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Discourse/FabricatorShorthand: Use the fabricator shorthand: `fab!(:foo)` end RUBY end it "does not register an offense when the fabricator has attributes" do expect_no_offenses(<<~RUBY) RSpec.describe "Foo" do fab!(:foo) { Fabricate(:foo, bar: 1) } end RUBY end it "does not register an offense when the identifier doesn't match" do expect_no_offenses(<<~RUBY) RSpec.describe "Foo" do fab!(:bar) { Fabricate(:foo) } end RUBY end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rubocop-discourse-3.7.0 | spec/lib/rubocop/cop/fabricator_shorthand_spec.rb |