This repository was archived by the owner on Oct 19, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +16
-5
lines changed
lib/generators/reactive_ruby/test_app/templates/assets/javascripts Expand file tree Collapse file tree 3 files changed +16
-5
lines changed Original file line number Diff line number Diff line change 11require 'opal'
2- require 'react-server.js'
32require 'hyper-react'
43require_tree './components'
Original file line number Diff line number Diff line change 33if ruby?
44RSpec . describe ReactiveRuby ::ComponentLoader do
55 GLOBAL_WRAPPER = <<-JS
6- var global = global || this;
7- var self = self || this;
6+ #{ React ::ServerRendering ::ExecJSRenderer ::GLOBAL_WRAPPER }
87 var console = {
98 warn: function(s) { }
109 };
1110 JS
1211
13- let ( :js ) { ::Rails . application . assets [ 'components' ] . to_s }
12+ let ( :js ) do
13+ if ::Rails . application . assets [ 'react-server.js' ] &&
14+ !::Rails . application . assets [ 'react-server.js' ] . to_s . start_with? ( "// A placeholder file" )
15+ react_source = ::Rails . application . assets [ 'react-server.js' ]
16+ else
17+ react_source = ::Rails . application . assets [ 'react.js' ]
18+ end
19+ ::Rails . application . assets [ 'components' ] . to_s + react_source . to_s
20+ end
1421 let ( :context ) { ExecJS . compile ( GLOBAL_WRAPPER + js ) }
1522 let ( :v8_context ) { ReactiveRuby ::ServerRendering . context_instance_for ( context ) }
1623
Original file line number Diff line number Diff line change @@ -77,7 +77,12 @@ def test_context(files = nil)
7777 end
7878
7979 def react_context
80- test_context ( 'components' )
80+ if ::Rails . application . assets [ 'react-server.js' ] &&
81+ !::Rails . application . assets [ 'react-server.js' ] . to_s . start_with? ( "// A placeholder file" )
82+ test_context ( [ 'components' , 'react-server.js' ] )
83+ else
84+ test_context ( [ 'components' , 'react.js' ] )
85+ end
8186 end
8287
8388 let ( :v8_context ) { TestV8Context . new }
You can’t perform that action at this time.
0 commit comments