Skip to content

Commit bd8dff7

Browse files
committed
Remove test duplication in ReactTest
1 parent 390c0db commit bd8dff7

File tree

2 files changed

+3
-21
lines changed

2 files changed

+3
-21
lines changed

Rakefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ Bundler::GemHelper.install_tasks
99
require 'pathname'
1010
namespace :react do
1111
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/')
1313
copy_react_asset('react.js', assets_path.join('development/react.js'))
1414
copy_react_asset('react.min.js', assets_path.join('production/react.js'))
1515
copy_react_asset('react-with-addons.js', assets_path.join('development-with-addons/react.js'))
1616
copy_react_asset('react-with-addons.min.js', assets_path.join('production-with-addons/react.js'))
1717
end
1818

1919
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')
2121
FileUtils.mkdir_p(destination.dirname.to_s)
2222
FileUtils.cp(vendor_path.join(source), destination.to_s)
2323
end

test/react_test.rb

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
require 'fileutils'
33

44
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
76
app_react_file_path = File.expand_path("../dummy/vendor/assets/javascripts/react.js", __FILE__)
87

98
react_file_token = "'test_confirmation_token_react_content_non_production';\n";
@@ -17,21 +16,4 @@ class ReactTest < ActionDispatch::IntegrationTest
1716
assert_response :success
1817
assert_equal react_file_token, @response.body
1918
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-
3719
end

0 commit comments

Comments
 (0)