@@ -10,33 +10,33 @@ class InstallGeneratorTest < Rails::Generators::TestCase
10
10
destination File . expand_path ( '../tmp' , __dir__ )
11
11
setup :prepare_destination
12
12
13
- test 'Assert all files are properly created when no asset pipeline present ' do
13
+ test 'Assert all files are properly created without sprockets and webpacker ' do
14
14
stub_configuration
15
15
run_generator
16
16
assert_file 'config/initializers/client_side_validations.rb'
17
17
assert_file 'public/javascripts/rails.validations.js'
18
18
end
19
19
20
- test 'Assert all files are properly created when asset pipeline present and disabled ' do
20
+ test 'Assert all files are properly created with sprockets ' do
21
21
stub_configuration
22
22
configuration = { }
23
23
configuration . stubs ( :prefix ) . returns ( '/assets' )
24
- ClientSideValidations ::Generators ::CopyAssetsGenerator . stubs ( :asset_pipeline_enabled ? ) . returns false
24
+ ClientSideValidations ::Generators ::CopyAssetsGenerator . stubs ( :sprockets ? ) . returns true
25
25
Rails . configuration . stubs ( :assets ) . returns ( configuration )
26
26
run_generator
27
27
assert_file 'config/initializers/client_side_validations.rb'
28
- assert_file 'public/javascripts/rails.validations.js'
28
+ assert_no_file 'public/javascripts/rails.validations.js'
29
29
end
30
30
31
- test 'Assert all files are properly created when asset pipeline present and enabled ' do
31
+ test 'Assert all files are properly created with webpacker ' do
32
32
stub_configuration
33
33
configuration = { }
34
34
configuration . stubs ( :prefix ) . returns ( '/assets' )
35
- ClientSideValidations ::Generators ::CopyAssetsGenerator . stubs ( :asset_pipeline_enabled ? ) . returns true
35
+ ClientSideValidations ::Generators ::CopyAssetsGenerator . stubs ( :webpacker ? ) . returns true
36
36
Rails . configuration . stubs ( :assets ) . returns ( configuration )
37
37
run_generator
38
38
assert_file 'config/initializers/client_side_validations.rb'
39
- assert_no_file 'app/assets /javascripts/rails.validations.js'
39
+ assert_no_file 'public /javascripts/rails.validations.js'
40
40
end
41
41
42
42
def stub_configuration
@@ -49,30 +49,27 @@ class CopyAssetsGeneratorTest < Rails::Generators::TestCase
49
49
destination File . expand_path ( '../tmp' , __dir__ )
50
50
setup :prepare_destination
51
51
52
- test 'Assert file is properly created when no asset pipeline present ' do
52
+ test 'Assert file is properly created without sprockets and webpacker ' do
53
53
stub_configuration
54
54
run_generator
55
55
assert_file 'public/javascripts/rails.validations.js'
56
56
end
57
57
58
- test 'Assert file is properly created when asset pipeline present and disabled ' do
58
+ test 'Assert file is properly created with sprockets ' do
59
59
stub_configuration
60
60
configuration = { }
61
61
configuration . stubs ( :prefix ) . returns ( '/assets' )
62
- ClientSideValidations ::Generators ::CopyAssetsGenerator . stubs ( :asset_pipeline_enabled ? ) . returns false
62
+ ClientSideValidations ::Generators ::CopyAssetsGenerator . stubs ( :sprockets ? ) . returns true
63
63
Rails . configuration . stubs ( :assets ) . returns ( configuration )
64
64
run_generator
65
- assert_file 'public /javascripts/rails.validations.js'
65
+ assert_file 'app/assets /javascripts/rails.validations.js'
66
66
end
67
67
68
- test 'Assert file is properly created when asset pipeline present and enabled ' do
68
+ test 'Assert file is properly created with webpacker ' do
69
69
stub_configuration
70
- configuration = { }
71
- configuration . stubs ( :prefix ) . returns ( '/assets' )
72
- ClientSideValidations ::Generators ::CopyAssetsGenerator . stubs ( :asset_pipeline_enabled? ) . returns true
73
- Rails . configuration . stubs ( :assets ) . returns ( configuration )
70
+ ClientSideValidations ::Generators ::CopyAssetsGenerator . stubs ( :webpacker? ) . returns true
74
71
run_generator
75
- assert_file 'app/assets /javascripts/rails.validations.js'
72
+ assert_file 'public /javascripts/rails.validations.js'
76
73
end
77
74
78
75
def stub_configuration
0 commit comments