File tree 2 files changed +3
-21
lines changed
2 files changed +3
-21
lines changed Original file line number Diff line number Diff line change @@ -9,15 +9,15 @@ Bundler::GemHelper.install_tasks
9
9
require 'pathname'
10
10
namespace :react do
11
11
task :copy_assets do
12
- assets_path = Pathname . new ( __dir__ ) . join ( 'lib/assets/react-source/' )
12
+ assets_path = Pathname . new ( File . dirname ( __FILE__ ) ) . join ( 'lib/assets/react-source/' )
13
13
copy_react_asset ( 'react.js' , assets_path . join ( 'development/react.js' ) )
14
14
copy_react_asset ( 'react.min.js' , assets_path . join ( 'production/react.js' ) )
15
15
copy_react_asset ( 'react-with-addons.js' , assets_path . join ( 'development-with-addons/react.js' ) )
16
16
copy_react_asset ( 'react-with-addons.min.js' , assets_path . join ( 'production-with-addons/react.js' ) )
17
17
end
18
18
19
19
def copy_react_asset ( source , destination )
20
- vendor_path = Pathname . new ( __dir__ ) . join ( 'vendor/react' )
20
+ vendor_path = Pathname . new ( File . dirname ( __FILE__ ) ) . join ( 'vendor/react' )
21
21
FileUtils . mkdir_p ( destination . dirname . to_s )
22
22
FileUtils . cp ( vendor_path . join ( source ) , destination . to_s )
23
23
end
Original file line number Diff line number Diff line change 2
2
require 'fileutils'
3
3
4
4
class ReactTest < ActionDispatch ::IntegrationTest
5
-
6
- test 'asset pipeline should deliver react file in a non-production variant' do
5
+ test 'asset pipeline should deliver drop-in react file replacement' do
7
6
app_react_file_path = File . expand_path ( "../dummy/vendor/assets/javascripts/react.js" , __FILE__ )
8
7
9
8
react_file_token = "'test_confirmation_token_react_content_non_production';\n " ;
@@ -17,21 +16,4 @@ class ReactTest < ActionDispatch::IntegrationTest
17
16
assert_response :success
18
17
assert_equal react_file_token , @response . body
19
18
end
20
-
21
- test 'asset pipeline should deliver drop-in react file replacement' do
22
- hidden_path = File . expand_path ( "../dummy/vendor/assets/react/test/react__.js" , __FILE__ )
23
- replacing_path = File . expand_path ( "../dummy/vendor/assets/react/test/react.js" , __FILE__ )
24
-
25
- FileUtils . mv hidden_path , replacing_path
26
- get '/assets/react.js'
27
-
28
- FileUtils . mv replacing_path , hidden_path
29
- FileUtils . rm_r CACHE_PATH if CACHE_PATH . exist?
30
-
31
- assert_response :success
32
- assert_equal "'test_confirmation_token_react_content';\n " , @response . body
33
-
34
- React ::Renderer . reset_combined_js!
35
- end
36
-
37
19
end
You can’t perform that action at this time.
0 commit comments