diff options
author | David Rodriguez <deivid.rodriguez@riseup.net> | 2023-10-20 10:22:51 +0200 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2023-11-13 11:06:10 +0900 |
commit | 59b361aaca0194bd526e32b7053948a49da4e39d (patch) | |
tree | 6eb15b40e15aa3042a877b85303e18dbf53cf904 /spec | |
parent | f273132bc017ee2d2c10f95f6629717f33ed54f9 (diff) |
[rubygems/rubygems] Refactor platform test helpers
https://github.com/rubygems/rubygems/commit/7ab4c203f9
Diffstat (limited to 'spec')
-rw-r--r-- | spec/bundler/commands/lock_spec.rb | 8 | ||||
-rw-r--r-- | spec/bundler/install/gemfile/specific_platform_spec.rb | 2 | ||||
-rw-r--r-- | spec/bundler/lock/lockfile_spec.rb | 2 | ||||
-rw-r--r-- | spec/bundler/support/platforms.rb | 11 |
4 files changed, 14 insertions, 9 deletions
diff --git a/spec/bundler/commands/lock_spec.rb b/spec/bundler/commands/lock_spec.rb index fd2462d4f3..ac220c9318 100644 --- a/spec/bundler/commands/lock_spec.rb +++ b/spec/bundler/commands/lock_spec.rb @@ -449,7 +449,7 @@ RSpec.describe "bundle lock" do allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile) lockfile = Bundler::LockfileParser.new(read_lockfile) - expect(lockfile.platforms).to match_array([java, x86_mingw32, local_platform].uniq) + expect(lockfile.platforms).to match_array(default_platform_list(java, x86_mingw32)) end it "supports adding new platforms with force_ruby_platform = true" do @@ -481,7 +481,7 @@ RSpec.describe "bundle lock" do allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile) lockfile = Bundler::LockfileParser.new(read_lockfile) - expect(lockfile.platforms).to match_array(["ruby", local_platform].uniq) + expect(lockfile.platforms).to match_array(default_platform_list("ruby")) end it "warns when adding an unknown platform" do @@ -494,12 +494,12 @@ RSpec.describe "bundle lock" do allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile) lockfile = Bundler::LockfileParser.new(read_lockfile) - expect(lockfile.platforms).to match_array([java, x86_mingw32, local_platform].uniq) + expect(lockfile.platforms).to match_array(default_platform_list(java, x86_mingw32)) bundle "lock --remove-platform java" lockfile = Bundler::LockfileParser.new(read_lockfile) - expect(lockfile.platforms).to match_array([x86_mingw32, local_platform].uniq) + expect(lockfile.platforms).to match_array(default_platform_list(x86_mingw32)) end it "also cleans up redundant platform gems when removing platforms" do diff --git a/spec/bundler/install/gemfile/specific_platform_spec.rb b/spec/bundler/install/gemfile/specific_platform_spec.rb index d4e2f25179..099ef35bbf 100644 --- a/spec/bundler/install/gemfile/specific_platform_spec.rb +++ b/spec/bundler/install/gemfile/specific_platform_spec.rb @@ -956,7 +956,7 @@ RSpec.describe "bundle install with specific platforms" do rack (3.0.7) PLATFORMS - #{formatted_lockfile_platforms(*["ruby", generic_local_platform].uniq)} + #{lockfile_platforms("ruby", generic_local_platform, :defaults => [])} DEPENDENCIES concurrent-ruby diff --git a/spec/bundler/lock/lockfile_spec.rb b/spec/bundler/lock/lockfile_spec.rb index f81b34b6d3..be1fdc37b5 100644 --- a/spec/bundler/lock/lockfile_spec.rb +++ b/spec/bundler/lock/lockfile_spec.rb @@ -1521,7 +1521,7 @@ RSpec.describe "the lockfile format" do indirect_dependency (1.2.3) PLATFORMS - #{formatted_lockfile_platforms(*["ruby", generic_local_platform].uniq)} + #{lockfile_platforms("ruby", generic_local_platform, :defaults => [])} DEPENDENCIES direct_dependency diff --git a/spec/bundler/support/platforms.rb b/spec/bundler/support/platforms.rb index eca1b2e60d..973d34a43a 100644 --- a/spec/bundler/support/platforms.rb +++ b/spec/bundler/support/platforms.rb @@ -95,12 +95,17 @@ module Spec 9999 end - def lockfile_platforms(*extra) - formatted_lockfile_platforms(local_platform, *extra) + def default_platform_list(*extra, defaults: default_locked_platforms) + defaults.concat(extra).uniq end - def formatted_lockfile_platforms(*platforms) + def lockfile_platforms(*extra, defaults: default_locked_platforms) + platforms = default_platform_list(*extra, :defaults => defaults) platforms.map(&:to_s).sort.join("\n ") end + + def default_locked_platforms + [local_platform] + end end end |