@@ -7,12 +7,19 @@ def mock_exe_directory(platform)
77 FileUtils . mkdir ( File . join ( dir , platform ) )
88 path = File . join ( dir , platform , "tailwindcss" )
99 FileUtils . touch ( path )
10- Gem :: Platform . stub ( :match_gem? , true ) do
10+ stub_gem_platform_match_gem ( true ) do
1111 yield ( dir , path )
1212 end
1313 end
1414 end
1515
16+ def stub_gem_platform_match_gem ( value )
17+ assert_respond_to ( Gem ::Platform , :match_gem? )
18+ Gem ::Platform . stub ( :match_gem? , value ) do
19+ yield
20+ end
21+ end
22+
1623 def mock_local_tailwindcss_install
1724 Dir . mktmpdir do |dir |
1825 path = File . join ( dir , "tailwindcss" )
@@ -35,7 +42,7 @@ def mock_local_tailwindcss_install
3542 end
3643
3744 test ".executable raises UnsupportedPlatformException when we're not on a supported platform" do
38- Gem :: Platform . stub ( :match_gem? , false ) do # nothing is supported
45+ stub_gem_platform_match_gem ( false ) do # nothing is supported
3946 assert_raises ( Tailwindcss ::Commands ::UnsupportedPlatformException ) do
4047 Tailwindcss ::Commands . executable
4148 end
@@ -66,7 +73,7 @@ def mock_local_tailwindcss_install
6673 end
6774
6875 test ".executable returns the executable in TAILWINDCSS_INSTALL_DIR when we're not on a supported platform" do
69- Gem :: Platform . stub ( :match_gem? , false ) do # nothing is supported
76+ stub_gem_platform_match_gem ( false ) do # nothing is supported
7077 mock_local_tailwindcss_install do |local_install_dir , expected |
7178 result = nil
7279 begin
0 commit comments