Skip to content

Commit

Permalink
Pass --test=rspec to bundle gem
Browse files Browse the repository at this point in the history
The generator expects to patch RSpec files, so specifying anything other
than `rspec` as the test framework would break generation. Therefore, it
makes sense to specify it ourselves, and save the user the time of
having to select it.

By doing this, we can also remove the patch to add the gem, since
Bundler will handle that for us.
  • Loading branch information
sambostock committed Feb 4, 2023
1 parent d88e661 commit a30fd76
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions lib/rubocop/extension/generator/generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def initialize(name)
end

def generate
system('bundle', 'gem', name, exception: true)
system('bundle', 'gem', '--test=rspec', name, exception: true)

put "lib/#{name}.rb", <<~RUBY
# frozen_string_literal: true
Expand Down Expand Up @@ -133,10 +133,6 @@ def self.defaults!
end
RUBY

patch 'Gemfile', /\z/, <<~RUBY
gem 'rspec'
RUBY

if Gem::Version.new(Bundler::VERSION) >= Gem::Version.new('2.3.9')
patch 'README.md', /\$ bundle add (.*)$/, '$ bundle add \1 --require=false'
else
Expand Down

0 comments on commit a30fd76

Please sign in to comment.