Skip to content

Commit

Permalink
Fix style
Browse files Browse the repository at this point in the history
  • Loading branch information
skryukov committed Nov 8, 2024
1 parent 54fbbcd commit 5b4c6df
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def component
end

def vary_header
response.headers["Vary"] = 'Accept-Language'
response.headers['Vary'] = 'Accept-Language'

render inertia: 'TestComponent'
end
Expand Down
30 changes: 14 additions & 16 deletions spec/inertia/rendering_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@

before { get always_props_path, headers: headers }

it "returns non-optional props on first load" do
expect(response.parsed_body["props"]).to eq({"always" => 'always prop', "regular" => 'regular prop' })
it 'returns non-optional props on first load' do
expect(response.parsed_body['props']).to eq({'always' => 'always prop', 'regular' => 'regular prop' })
end

context 'with a partial reload' do
Expand All @@ -274,8 +274,8 @@
'X-Inertia-Partial-Component' => 'TestComponent',
}}

it "returns listed and always props" do
expect(response.parsed_body["props"]).to eq({"always" => 'always prop', "optional" => 'optional prop' })
it 'returns listed and always props' do
expect(response.parsed_body['props']).to eq({'always' => 'always prop', 'optional' => 'optional prop' })
end
end
end
Expand Down Expand Up @@ -323,26 +323,24 @@

context 'deferred prop rendering' do
context 'on first load' do
let (:page) {
InertiaRails::Renderer.new('TestComponent', controller, request, response, '', props: { name: 'Brian', sport: 'basketball', level: 'worse than he believes', grit: 'intense' }).send(:page)
}
let(:headers) { { 'X-Inertia' => true } }

before { get deferred_props_path, headers: headers }

it "does not include defer props inside props in first load" do
expect(JSON.parse(response.body)["props"]).to eq({ "name" => 'Brian' })
it 'does not include defer props inside props in first load' do
expect(response.parsed_body['props']).to eq({ 'name' => 'Brian' })
end

it "returns deferredProps" do
expect(JSON.parse(response.body)["deferredProps"]).to eq(
"default" => ["level", "grit"],
"other" => ["sport"]
it 'returns deferredProps' do
expect(response.parsed_body['deferredProps']).to eq(
'default' => ['level', 'grit'],
'other' => ['sport']
)
end
end

context 'with a partial reload' do
let (:page) {
let(:page) {
InertiaRails::Renderer.new('TestComponent', controller, request, response, '', props: { sport: 'basketball', level: 'worse than he believes', grit: 'intense' }).send(:page)
}
let(:headers) { {
Expand All @@ -357,8 +355,8 @@
it { is_expected.to include('intense') }
it { is_expected.to include('worse') }
it { is_expected.not_to include('basketball') }
it "does not deferredProps key in json" do
expect(JSON.parse(response.body)["deferredProps"]).to eq(nil)
it 'does not deferredProps key in json' do
expect(response.parsed_body['deferredProps']).to eq(nil)
end
end
end
Expand Down

0 comments on commit 5b4c6df

Please sign in to comment.