@@ -86,18 +86,23 @@ def finished_all_ajax_requests?
8686  include_examples  "React Component" ,  "div#my-hello-world-id" 
8787end 
8888
89- describe  "Turbolinks across pages" ,  :js  do 
90-   subject  {  page  } 
89+ shared_context  'with pro features and immediate hydration'  do 
90+   before  do 
91+     allow ( ReactOnRails ::Utils ) . to  receive ( :react_on_rails_pro_licence_valid? ) . and_return ( true ) 
92+   end 
9193
9294  around  do  |example |
9395    ReactOnRails . configure  {  |config | config . immediate_hydration  =  true  } 
9496    example . run 
9597    ReactOnRails . configure  {  |config | config . immediate_hydration  =  false  } 
9698  end 
99+ end 
97100
98-   it  "changes name in message according to input"  do 
99-     allow ( ReactOnRails ::Utils ) . to  receive ( :react_on_rails_pro_licence_valid? ) . and_return ( true ) 
101+ describe  "Turbolinks across pages" ,  :js  do 
102+   subject  {  page  } 
103+   include_context  'with pro features and immediate hydration' 
100104
105+   it  "changes name in message according to input"  do 
101106    visit  "/client_side_hello_world" 
102107    expect_change_text_in_dom_selector ( "#HelloWorld-react-component-0" ) 
103108    click_on  "Hello World Component Server Rendered, with extra options" 
@@ -107,16 +112,9 @@ def finished_all_ajax_requests?
107112
108113describe  "TurboStream send react component" ,  :js  do 
109114  subject  {  page  } 
110- 
111-   around  do  |example |
112-     ReactOnRails . configure  {  |config | config . immediate_hydration  =  true  } 
113-     example . run 
114-     ReactOnRails . configure  {  |config | config . immediate_hydration  =  false  } 
115-   end 
115+   include_context  'with pro features and immediate hydration' 
116116
117117  it  "force load hello-world component immediately"  do 
118-     allow ( ReactOnRails ::Utils ) . to  receive ( :react_on_rails_pro_licence_valid? ) . and_return ( true ) 
119- 
120118    visit  "/turbo_frame_tag_hello_world" 
121119    click_on  "send me hello-turbo-stream component" 
122120    expect ( page ) . to  have_text  "Hello, Mrs. Client Side Rendering From Turbo Stream!" 
0 commit comments