5
5
class RakeTasksTest < ViteRuby ::Test
6
6
def test_rake_tasks
7
7
assert ViteRuby . install_tasks
8
- output = Dir . chdir ( test_app_path ) { `rake -T` }
8
+ output = Dir . chdir ( path_to_test_app ) { `rake -T` }
9
9
assert_includes output , 'vite:build'
10
10
assert_includes output , 'vite:build_ssr'
11
11
assert_includes output , 'vite:clean'
@@ -15,15 +15,15 @@ def test_rake_tasks
15
15
end
16
16
17
17
def test_rake_task_vite_check_binstubs
18
- output = Dir . chdir ( test_app_path ) { `rake vite:verify_install 2>&1` }
18
+ output = Dir . chdir ( path_to_test_app ) { `rake vite:verify_install 2>&1` }
19
19
refute_includes output , 'vite binstub not found.'
20
20
end
21
21
22
22
def test_rake_vite_install_dependencies_in_non_production_environments
23
23
assert_includes test_app_dev_dependencies , 'right-pad'
24
24
25
25
ViteRuby . commands . send ( :with_node_env , 'test' ) do
26
- Dir . chdir ( test_app_path ) do
26
+ Dir . chdir ( path_to_test_app ) do
27
27
`bundle exec rake vite:install_dependencies`
28
28
end
29
29
end
@@ -34,7 +34,7 @@ def test_rake_vite_install_dependencies_in_non_production_environments
34
34
35
35
def test_rake_vite_install_dependencies_in_production_environment
36
36
ViteRuby . commands . send ( :with_node_env , 'production' ) do
37
- Dir . chdir ( test_app_path ) do
37
+ Dir . chdir ( path_to_test_app ) do
38
38
`bundle exec rake vite:install_dependencies`
39
39
end
40
40
end
@@ -45,17 +45,17 @@ def test_rake_vite_install_dependencies_in_production_environment
45
45
46
46
private
47
47
48
- def test_app_path
48
+ def path_to_test_app
49
49
File . expand_path ( 'test_app' , __dir__ )
50
50
end
51
51
52
52
def test_app_dev_dependencies
53
- package_json = File . expand_path ( 'package.json' , test_app_path )
53
+ package_json = File . expand_path ( 'package.json' , path_to_test_app )
54
54
JSON . parse ( File . read ( package_json ) ) [ 'devDependencies' ]
55
55
end
56
56
57
57
def installed_node_module_names
58
- node_modules_path = File . expand_path ( 'node_modules' , test_app_path )
58
+ node_modules_path = File . expand_path ( 'node_modules' , path_to_test_app )
59
59
Dir . chdir ( node_modules_path ) { Dir . glob ( '*' ) }
60
60
end
61
61
end
0 commit comments