From 5b4c6df83e7efc3c6bc0be2e30e6c96bbc96f470 Mon Sep 17 00:00:00 2001 From: Svyatoslav Kryukov Date: Fri, 8 Nov 2024 11:38:03 +0300 Subject: [PATCH] Fix style --- .../inertia_render_test_controller.rb | 2 +- spec/inertia/rendering_spec.rb | 30 +++++++++---------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/spec/dummy/app/controllers/inertia_render_test_controller.rb b/spec/dummy/app/controllers/inertia_render_test_controller.rb index 3734c43..d48d54a 100644 --- a/spec/dummy/app/controllers/inertia_render_test_controller.rb +++ b/spec/dummy/app/controllers/inertia_render_test_controller.rb @@ -36,7 +36,7 @@ def component end def vary_header - response.headers["Vary"] = 'Accept-Language' + response.headers['Vary'] = 'Accept-Language' render inertia: 'TestComponent' end diff --git a/spec/inertia/rendering_spec.rb b/spec/inertia/rendering_spec.rb index f9cbf36..0e995cb 100644 --- a/spec/inertia/rendering_spec.rb +++ b/spec/inertia/rendering_spec.rb @@ -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 @@ -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 @@ -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) { { @@ -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