diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 01135a4..c78545e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,6 +26,7 @@ jobs: - uses: ruby/setup-ruby@v1 with: ruby-version: ${{matrix.ruby}} + rubygems: latest bundler: latest bundler-cache: true - name: Run tests diff --git a/tailwindcss-rails.gemspec b/tailwindcss-rails.gemspec index 672c988..02c10fb 100644 --- a/tailwindcss-rails.gemspec +++ b/tailwindcss-rails.gemspec @@ -14,6 +14,8 @@ Gem::Specification.new do |spec| "rubygems_mfa_required" => "true" } + spec.required_rubygems_version = ">= 3.2.0" # for Gem::Platform#match_gem? + spec.files = Dir["{app,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"] spec.bindir = "exe" spec.executables << "tailwindcss" diff --git a/test/lib/tailwindcss/commands_test.rb b/test/lib/tailwindcss/commands_test.rb index d09d8a9..4711222 100644 --- a/test/lib/tailwindcss/commands_test.rb +++ b/test/lib/tailwindcss/commands_test.rb @@ -7,12 +7,19 @@ def mock_exe_directory(platform) FileUtils.mkdir(File.join(dir, platform)) path = File.join(dir, platform, "tailwindcss") FileUtils.touch(path) - Gem::Platform.stub(:match_gem?, true) do + stub_gem_platform_match_gem(true) do yield(dir, path) end end end + def stub_gem_platform_match_gem(value) + assert_respond_to(Gem::Platform, :match_gem?) + Gem::Platform.stub(:match_gem?, value) do + yield + end + end + def mock_local_tailwindcss_install Dir.mktmpdir do |dir| path = File.join(dir, "tailwindcss") @@ -35,7 +42,7 @@ def mock_local_tailwindcss_install end test ".executable raises UnsupportedPlatformException when we're not on a supported platform" do - Gem::Platform.stub(:match_gem?, false) do # nothing is supported + stub_gem_platform_match_gem(false) do # nothing is supported assert_raises(Tailwindcss::Commands::UnsupportedPlatformException) do Tailwindcss::Commands.executable end @@ -66,7 +73,7 @@ def mock_local_tailwindcss_install end test ".executable returns the executable in TAILWINDCSS_INSTALL_DIR when we're not on a supported platform" do - Gem::Platform.stub(:match_gem?, false) do # nothing is supported + stub_gem_platform_match_gem(false) do # nothing is supported mock_local_tailwindcss_install do |local_install_dir, expected| result = nil begin