From 5e4819764a23cf4cfb437d57702454f6e1097a3b Mon Sep 17 00:00:00 2001 From: Karina Kwiatek Date: Tue, 12 Jul 2022 16:07:36 +0200 Subject: [PATCH] Test theme color in web app manifest --- spec/controllers/static_controller_spec.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/spec/controllers/static_controller_spec.rb b/spec/controllers/static_controller_spec.rb index 426b37bf..e124fb3f 100644 --- a/spec/controllers/static_controller_spec.rb +++ b/spec/controllers/static_controller_spec.rb @@ -59,6 +59,23 @@ describe StaticController, type: :controller do 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/") + expect(body["theme_color"]).to eq("#5e35b1") + end + + context "user with a theme is logged in" do + let(:user) { FactoryBot.create(:user) } + let!(:theme) { FactoryBot.create(:theme, user: user) } + + before do + sign_in(user) + end + + it "uses the user's theme" do + subject + expect(response).to have_http_status(200) + body = JSON.parse(response.body) + expect(body["theme_color"]).to eq("#8e8cd8") + end end end end \ No newline at end of file