summaryrefslogtreecommitdiff
path: root/spec/bundler/commands
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2021-02-09 22:53:57 +0900
committerGitHub <noreply@github.com>2021-02-09 22:53:57 +0900
commit09c681ab38df33468570534bef7609222e49c6f4 (patch)
tree52f9edbbb1d0c984e370d2ae35729a16e51890b8 /spec/bundler/commands
parent9aba46d8d80473594e567dff1652626e7b2a77b0 (diff)
Merge RubyGems 3.2.9 and Bundler 2.2.9 (#4158)
Diffstat (limited to 'spec/bundler/commands')
-rw-r--r--spec/bundler/commands/info_spec.rb2
-rw-r--r--spec/bundler/commands/lock_spec.rb24
-rw-r--r--spec/bundler/commands/newgem_spec.rb47
-rw-r--r--spec/bundler/commands/show_spec.rb2
4 files changed, 73 insertions, 2 deletions
diff --git a/spec/bundler/commands/info_spec.rb b/spec/bundler/commands/info_spec.rb
index 6bc07ea399..7702959306 100644
--- a/spec/bundler/commands/info_spec.rb
+++ b/spec/bundler/commands/info_spec.rb
@@ -165,7 +165,7 @@ RSpec.describe "bundle info" do
G
bundle "info rac"
- expect(out).to eq "1 : rack\n2 : rack-obama\n0 : - exit -\n>"
+ expect(out).to match(/\A1 : rack\n2 : rack-obama\n0 : - exit -(\n>)?\z/)
end
end
diff --git a/spec/bundler/commands/lock_spec.rb b/spec/bundler/commands/lock_spec.rb
index afc3b03a53..44bde4a9b8 100644
--- a/spec/bundler/commands/lock_spec.rb
+++ b/spec/bundler/commands/lock_spec.rb
@@ -220,6 +220,30 @@ RSpec.describe "bundle lock" do
expect(lockfile.platforms).to match_array(local_platforms.unshift(java, mingw).uniq)
end
+ it "supports adding new platforms with force_ruby_platform = true" do
+ lockfile <<-L
+ GEM
+ remote: #{file_uri_for(gem_repo1)}/
+ specs:
+ platform_specific (1.0)
+ platform_specific (1.0-x86-linux)
+
+ PLATFORMS
+ ruby
+ x86-linux
+
+ DEPENDENCIES
+ platform_specific
+ L
+
+ bundle "config set force_ruby_platform true"
+ bundle "lock --add-platform java x86-mingw32"
+
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
+ lockfile = Bundler::LockfileParser.new(read_lockfile)
+ expect(lockfile.platforms).to contain_exactly(rb, linux, java, mingw)
+ end
+
it "supports adding the `ruby` platform" do
bundle "lock --add-platform ruby"
diff --git a/spec/bundler/commands/newgem_spec.rb b/spec/bundler/commands/newgem_spec.rb
index 265268a1fe..c5294a6b4d 100644
--- a/spec/bundler/commands/newgem_spec.rb
+++ b/spec/bundler/commands/newgem_spec.rb
@@ -158,6 +158,26 @@ RSpec.describe "bundle gem" do
end
end
+ shared_examples_for "--changelog flag" do
+ before do
+ bundle "gem #{gem_name} --changelog"
+ end
+ it "generates a gem skeleton with a CHANGELOG", :readline do
+ gem_skeleton_assertions
+ expect(bundled_app("#{gem_name}/CHANGELOG.md")).to exist
+ end
+ end
+
+ shared_examples_for "--no-changelog flag" do
+ before do
+ bundle "gem #{gem_name} --no-changelog"
+ end
+ it "generates a gem skeleton without a CHANGELOG", :readline do
+ gem_skeleton_assertions
+ expect(bundled_app("#{gem_name}/CHANGELOG.md")).to_not exist
+ end
+ end
+
shared_examples_for "--rubocop flag" do
before do
bundle "gem #{gem_name} --rubocop"
@@ -902,6 +922,22 @@ RSpec.describe "bundle gem" do
it_behaves_like "--rubocop flag"
it_behaves_like "--no-rubocop flag"
end
+
+ context "with changelog option in bundle config settings set to true" do
+ before do
+ global_config "BUNDLE_GEM__CHANGELOG" => "true"
+ end
+ it_behaves_like "--changelog flag"
+ it_behaves_like "--no-changelog flag"
+ end
+
+ context "with changelog option in bundle config settings set to false" do
+ before do
+ global_config "BUNDLE_GEM__CHANGELOG" => "false"
+ end
+ it_behaves_like "--changelog flag"
+ it_behaves_like "--no-changelog flag"
+ end
end
context "gem naming with underscore", :readline do
@@ -1087,6 +1123,17 @@ Usage: "bundle gem NAME [OPTIONS]"
expect(bundled_app("foobar/CODE_OF_CONDUCT.md")).to exist
end
+
+ it "asks about CHANGELOG" do
+ global_config "BUNDLE_GEM__MIT" => "false", "BUNDLE_GEM__TEST" => "false", "BUNDLE_GEM__CI" => "false", "BUNDLE_GEM__RUBOCOP" => "false",
+ "BUNDLE_GEM__COC" => "false"
+
+ bundle "gem foobar" do |input, _, _|
+ input.puts "yes"
+ end
+
+ expect(bundled_app("foobar/CHANGELOG.md")).to exist
+ end
end
context "on conflicts with a previously created file", :readline do
diff --git a/spec/bundler/commands/show_spec.rb b/spec/bundler/commands/show_spec.rb
index 30e9de9686..2adb121616 100644
--- a/spec/bundler/commands/show_spec.rb
+++ b/spec/bundler/commands/show_spec.rb
@@ -173,7 +173,7 @@ RSpec.describe "bundle show", :bundler => "< 3" do
G
bundle "show rac"
- expect(out).to eq "1 : rack\n2 : rack-obama\n0 : - exit -\n>"
+ expect(out).to match(/\A1 : rack\n2 : rack-obama\n0 : - exit -(\n>)?\z/)
end
end