File tree 2 files changed +13
-1
lines changed 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 2
2
3
3
4
4
when_webpacker_available do
5
- class ReactRailsUJSTest < ActionDispatch ::IntegrationTest
5
+ class ReactRailsWebpackerTest < ActionDispatch ::IntegrationTest
6
6
include Capybara ::DSL
7
7
8
8
setup do
9
9
Capybara . current_driver = Capybara . javascript_driver
10
10
end
11
11
12
+ teardown do
13
+ clear_webpacker_packs
14
+ end
15
+
12
16
test 'it mounts pages from the pack' do
13
17
visit '/pack_component'
14
18
assert page . has_content? ( 'Export Default' )
Original file line number Diff line number Diff line change @@ -133,13 +133,21 @@ def when_sprockets_available
133
133
134
134
def when_webpacker_available
135
135
if defined? ( Webpacker )
136
+ clear_webpacker_packs
136
137
Dir . chdir ( "./test/dummy" ) do
137
138
Rake ::Task [ 'webpacker:compile' ] . invoke
138
139
end
140
+ # Reload cached JSON manifest:
141
+ Webpacker ::Manifest . load
139
142
yield
140
143
end
141
144
end
142
145
146
+ def clear_webpacker_packs
147
+ packs_directory = File . expand_path ( "../dummy/public/packs" , __FILE__ )
148
+ FileUtils . rm_rf ( packs_directory )
149
+ end
150
+
143
151
def fetch_asset_body ( asset_logical_path )
144
152
Rails . application . assets [ asset_logical_path ] . to_s
145
153
end
You can’t perform that action at this time.
0 commit comments