Skip to content

Commit

Permalink
Fix simulate_windows helper
Browse files Browse the repository at this point in the history
It should also set the proper class variable so that `Gem.win_platform?`
returns true.
  • Loading branch information
deivid-rodriguez committed Jul 7, 2022
1 parent 20264c5 commit 0fbf690
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bundler/spec/support/hax.rb
Expand Up @@ -14,6 +14,10 @@ def self.ruby=(ruby)
@default_specifications_dir = nil
end

if ENV["BUNDLER_SPEC_WINDOWS"]
@@win_platform = true # rubocop:disable Sryle/ClassVars
end

if ENV["BUNDLER_SPEC_PLATFORM"]
class Platform
@local = new(ENV["BUNDLER_SPEC_PLATFORM"])
Expand Down
4 changes: 4 additions & 0 deletions bundler/spec/support/helpers.rb
Expand Up @@ -446,11 +446,15 @@ def simulate_platform(platform)
end

def simulate_windows(platform = mswin)
old = ENV["BUNDLER_SPEC_WINDOWS"]
ENV["BUNDLER_SPEC_WINDOWS"] = "true"
simulate_platform platform do
simulate_bundler_version_when_missing_prerelease_default_gem_activation do
yield
end
end
ensure
ENV["BUNDLER_SPEC_WINDOWS"] = old
end

def simulate_bundler_version_when_missing_prerelease_default_gem_activation
Expand Down

0 comments on commit 0fbf690

Please sign in to comment.