@@ -7,12 +7,19 @@ def mock_exe_directory(platform)
7
7
FileUtils . mkdir ( File . join ( dir , platform ) )
8
8
path = File . join ( dir , platform , "tailwindcss" )
9
9
FileUtils . touch ( path )
10
- Gem :: Platform . stub ( :match_gem? , true ) do
10
+ stub_gem_platform_match_gem ( true ) do
11
11
yield ( dir , path )
12
12
end
13
13
end
14
14
end
15
15
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
+
16
23
def mock_local_tailwindcss_install
17
24
Dir . mktmpdir do |dir |
18
25
path = File . join ( dir , "tailwindcss" )
@@ -35,7 +42,7 @@ def mock_local_tailwindcss_install
35
42
end
36
43
37
44
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
39
46
assert_raises ( Tailwindcss ::Commands ::UnsupportedPlatformException ) do
40
47
Tailwindcss ::Commands . executable
41
48
end
@@ -66,7 +73,7 @@ def mock_local_tailwindcss_install
66
73
end
67
74
68
75
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
70
77
mock_local_tailwindcss_install do |local_install_dir , expected |
71
78
result = nil
72
79
begin
0 commit comments