From e11b22236856afccadcebafbc1edf40ab7a0db5d Mon Sep 17 00:00:00 2001 From: Karina Kwiatek Date: Mon, 11 Jul 2022 16:26:04 +0200 Subject: [PATCH] Add test for `static#webapp_manifest` --- spec/controllers/static_controller_spec.rb | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/spec/controllers/static_controller_spec.rb b/spec/controllers/static_controller_spec.rb index 4b43c7b1..426b37bf 100644 --- a/spec/controllers/static_controller_spec.rb +++ b/spec/controllers/static_controller_spec.rb @@ -38,4 +38,27 @@ describe StaticController, type: :controller do end end end + + describe "#webapp_manifest" do + subject { get :webapp_manifest } + + before do + stub_const("APP_CONFIG", { + "site_name" => "Specspring", + "hostname" => "test.host", + "https" => false, + "items_per_page" => 5, + }) + end + + it "returns a web app manifest" do + subject + expect(response).to have_http_status(200) + body = JSON.parse(response.body) + + expect(body["name"]).to eq("Specspring") + expect(body["start_url"]).to eq("http://test.host/?source=pwa") + expect(body["scope"]).to eq("http://test.host/") + end + end end \ No newline at end of file