diff options
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/bundler/commands/newgem_spec.rb | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/spec/bundler/commands/newgem_spec.rb b/spec/bundler/commands/newgem_spec.rb index 55a04b69c5..c4e8b3a6e7 100644 --- a/spec/bundler/commands/newgem_spec.rb +++ b/spec/bundler/commands/newgem_spec.rb @@ -312,28 +312,28 @@ RSpec.describe "bundle gem" do it "has no rubocop offenses when using --ext and --linter=rubocop flag", :readline do skip "ruby_core has an 'ast.rb' file that gets in the middle and breaks this spec" if ruby_core? - bundle "gem #{gem_name} --ext --linter=rubocop" + bundle "gem #{gem_name} --ext=c --linter=rubocop" bundle_exec_rubocop expect(last_command).to be_success end it "has no rubocop offenses when using --ext, --test=minitest, and --linter=rubocop flag", :readline do skip "ruby_core has an 'ast.rb' file that gets in the middle and breaks this spec" if ruby_core? - bundle "gem #{gem_name} --ext --test=minitest --linter=rubocop" + bundle "gem #{gem_name} --ext=c --test=minitest --linter=rubocop" bundle_exec_rubocop expect(last_command).to be_success end it "has no rubocop offenses when using --ext, --test=rspec, and --linter=rubocop flag", :readline do skip "ruby_core has an 'ast.rb' file that gets in the middle and breaks this spec" if ruby_core? - bundle "gem #{gem_name} --ext --test=rspec --linter=rubocop" + bundle "gem #{gem_name} --ext=c --test=rspec --linter=rubocop" bundle_exec_rubocop expect(last_command).to be_success end it "has no rubocop offenses when using --ext, --ext=test-unit, and --linter=rubocop flag", :readline do skip "ruby_core has an 'ast.rb' file that gets in the middle and breaks this spec" if ruby_core? - bundle "gem #{gem_name} --ext --test=test-unit --linter=rubocop" + bundle "gem #{gem_name} --ext=c --test=test-unit --linter=rubocop" bundle_exec_rubocop expect(last_command).to be_success end @@ -1322,13 +1322,32 @@ RSpec.describe "bundle gem" do include_examples "generating a gem" - context "--ext parameter set" do - let(:flags) { "--ext" } + context "--ext parameter with no value" do + context "is deprecated", :bundler => "< 3" do + it "prints deprecation when used after gem name" do + bundle ["gem", "--ext", gem_name].compact.join(" ") + expect(err).to include "[DEPRECATED] Option `--ext` without explicit value is deprecated." + expect(bundled_app("#{gem_name}/ext/#{gem_name}/#{gem_name}.c")).to exist + end + + it "prints deprecation when used before gem name" do + bundle ["gem", gem_name, "--ext"].compact.join(" ") + expect(bundled_app("#{gem_name}/ext/#{gem_name}/#{gem_name}.c")).to exist + end + end + end + + context "--ext parameter set with C" do + let(:flags) { "--ext=c" } before do bundle ["gem", gem_name, flags].compact.join(" ") end + it "is not deprecated" do + expect(err).not_to include "[DEPRECATED] Option `--ext` without explicit value is deprecated." + end + it "builds ext skeleton" do expect(bundled_app("#{gem_name}/ext/#{gem_name}/extconf.rb")).to exist expect(bundled_app("#{gem_name}/ext/#{gem_name}/#{gem_name}.h")).to exist |
