File tree 4 files changed +12
-13
lines changed 4 files changed +12
-13
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ def render
41
41
end
42
42
if @request . headers [ 'X-Inertia' ]
43
43
@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 ]
45
45
else
46
46
return render_ssr if configuration . ssr_enabled rescue nil
47
47
@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)
32
32
else
33
33
# Sequential Inertia request
34
34
@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" ]
37
38
end
38
39
end
39
40
end
@@ -81,8 +82,7 @@ def inertia_tests_setup?
81
82
82
83
RSpec ::Matchers . define :have_exact_props do |expected_props |
83
84
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
86
86
end
87
87
88
88
failure_message do |inertia |
@@ -92,8 +92,7 @@ def inertia_tests_setup?
92
92
93
93
RSpec ::Matchers . define :include_props do |expected_props |
94
94
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
97
96
end
98
97
99
98
failure_message do |inertia |
Original file line number Diff line number Diff line change 6
6
it 'has the props' do
7
7
get instance_props_test_path
8
8
9
- expect_inertia . to have_exact_props ( { ' name' => 'Brandon' , ' sport' => 'hockey' } )
9
+ expect_inertia . to have_exact_props ( { name : 'Brandon' , sport : 'hockey' } )
10
10
end
11
11
end
12
12
31
31
get default_render_test_path
32
32
33
33
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' } )
35
35
end
36
36
37
37
context 'a rendering transformation is provided' do
Original file line number Diff line number Diff line change @@ -38,15 +38,15 @@ def puts(thing)
38
38
before { get props_path , headers : { 'X-Inertia' : true } }
39
39
40
40
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' } )
42
42
end
43
43
44
44
it 'includes props' do
45
- expect_inertia . to include_props ( { sport : 'hockey' } )
45
+ expect_inertia . to include_props ( { " sport" => 'hockey' } )
46
46
end
47
47
48
48
it 'can retrieve props' do
49
- expect ( inertia . props [ : name] ) . to eq 'Brandon'
49
+ expect ( inertia . props [ " name" ] ) . to eq 'Brandon'
50
50
end
51
51
end
52
52
@@ -139,7 +139,7 @@ def puts(thing)
139
139
expect_inertia . to have_exact_props ( {
140
140
someProperty : {
141
141
property_a : "some value" ,
142
- ' property_b' => "this value" ,
142
+ property_b : "this value" ,
143
143
} ,
144
144
property_c : "some other value"
145
145
} )
You can’t perform that action at this time.
0 commit comments