Skip to content

Commit ebddc88

Browse files
committed
Add spec showing that inertia_share accepts a hash
1 parent fac9eba commit ebddc88

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

spec/dummy/app/controllers/inertia_share_test_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
class InertiaShareTestController < ApplicationController
22
inertia_share name: 'Brandon'
33
inertia_share sport: -> { 'hockey' }
4+
inertia_share({a_hash: 'also works'})
45
inertia_share do
56
{
67
position: 'center',

spec/inertia/sharing_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
subject { JSON.parse(response.body)['props'].deep_symbolize_keys }
33

44
context 'using inertia share' do
5-
let(:props) { {name: 'Brandon', sport: 'hockey', position: 'center', number: 29} }
5+
let(:props) { {name: 'Brandon', sport: 'hockey', position: 'center', number: 29, a_hash: 'also works'} }
66
before { get share_path, headers: {'X-Inertia' => true} }
77

88
it { is_expected.to eq props }
@@ -18,7 +18,7 @@
1818
end
1919

2020
context 'using inertia share in subsequent requests' do
21-
let(:props) { {name: 'Brandon', sport: 'hockey', position: 'center', number: 29} }
21+
let(:props) { {name: 'Brandon', sport: 'hockey', position: 'center', number: 29, a_hash: 'also works'} }
2222

2323
before do
2424
get share_path, headers: {'X-Inertia' => true}
@@ -29,7 +29,7 @@
2929
end
3030

3131
context 'using inertia share with inheritance' do
32-
let(:props) { {name: 'No Longer Brandon', sport: 'hockey', position: 'center', number: 29} }
32+
let(:props) { {name: 'No Longer Brandon', sport: 'hockey', position: 'center', number: 29, a_hash: 'also works'} }
3333

3434
before do
3535
get share_with_inherited_path, headers: {'X-Inertia' => true}
@@ -39,7 +39,7 @@
3939
end
4040

4141
context 'with errors' do
42-
let(:props) { {name: 'Brandon', sport: 'hockey', position: 'center', number: 29} }
42+
let(:props) { {name: 'Brandon', sport: 'hockey', position: 'center', number: 29, a_hash: 'also works'} }
4343
let(:errors) { 'rearview mirror is present' }
4444
before {
4545
allow_any_instance_of(ActionDispatch::Request).to receive(:session) {

0 commit comments

Comments
 (0)