File tree Expand file tree Collapse file tree 4 files changed +12
-13
lines changed
Expand file tree Collapse file tree 4 files changed +12
-13
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ def render
4141 end
4242 if @request . headers [ 'X-Inertia' ]
4343 @response . set_header ( 'X-Inertia' , 'true' )
44- @render_method . call json : page , status : @response . status , content_type : Mime [ :json ]
44+ @render_method . call json : page . to_json , status : @response . status , content_type : Mime [ :json ]
4545 else
4646 return render_ssr if configuration . ssr_enabled rescue nil
4747 @render_method . call template : 'inertia' , layout : layout , locals : view_data . merge ( page : page )
Original file line number Diff line number Diff line change @@ -32,8 +32,9 @@ def set_values(params)
3232 else
3333 # Sequential Inertia request
3434 @view_data = { }
35- @props = params [ :json ] [ :props ]
36- @component = params [ :json ] [ :component ]
35+ json = JSON . parse ( params [ :json ] )
36+ @props = json [ "props" ]
37+ @component = json [ "component" ]
3738 end
3839 end
3940 end
@@ -81,8 +82,7 @@ def inertia_tests_setup?
8182
8283RSpec ::Matchers . define :have_exact_props do |expected_props |
8384 match do |inertia |
84- # Computed props have symbolized keys.
85- expect ( inertia . props ) . to eq expected_props . deep_symbolize_keys
85+ expect ( inertia . props ) . to eq expected_props
8686 end
8787
8888 failure_message do |inertia |
@@ -92,8 +92,7 @@ def inertia_tests_setup?
9292
9393RSpec ::Matchers . define :include_props do |expected_props |
9494 match do |inertia |
95- # Computed props have symbolized keys.
96- expect ( inertia . props ) . to include expected_props . deep_symbolize_keys
95+ expect ( inertia . props ) . to include expected_props
9796 end
9897
9998 failure_message do |inertia |
Original file line number Diff line number Diff line change 66 it 'has the props' do
77 get instance_props_test_path
88
9- expect_inertia . to have_exact_props ( { ' name' => 'Brandon' , ' sport' => 'hockey' } )
9+ expect_inertia . to have_exact_props ( { name : 'Brandon' , sport : 'hockey' } )
1010 end
1111 end
1212
3131 get default_render_test_path
3232
3333 expect_inertia . to render_component ( 'inertia_rails_mimic/default_render_test' )
34- expect_inertia . to include_props ( { ' name' => 'Brian' } )
34+ expect_inertia . to include_props ( { name : 'Brian' } )
3535 end
3636
3737 context 'a rendering transformation is provided' do
Original file line number Diff line number Diff line change @@ -38,15 +38,15 @@ def puts(thing)
3838 before { get props_path , headers : { 'X-Inertia' : true } }
3939
4040 it 'has props' do
41- expect_inertia . to have_exact_props ( { name : 'Brandon' , sport : 'hockey' } )
41+ expect_inertia . to have_exact_props ( { " name" => 'Brandon' , " sport" => 'hockey' } )
4242 end
4343
4444 it 'includes props' do
45- expect_inertia . to include_props ( { sport : 'hockey' } )
45+ expect_inertia . to include_props ( { " sport" => 'hockey' } )
4646 end
4747
4848 it 'can retrieve props' do
49- expect ( inertia . props [ : name] ) . to eq 'Brandon'
49+ expect ( inertia . props [ " name" ] ) . to eq 'Brandon'
5050 end
5151 end
5252
@@ -139,7 +139,7 @@ def puts(thing)
139139 expect_inertia . to have_exact_props ( {
140140 someProperty : {
141141 property_a : "some value" ,
142- ' property_b' => "this value" ,
142+ property_b : "this value" ,
143143 } ,
144144 property_c : "some other value"
145145 } )
You can’t perform that action at this time.
0 commit comments