From 4044696a8a10b202026f51e52f5cd22c2478f201 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Wed, 6 May 2020 13:48:16 +0200 Subject: [PATCH] Add specs for `ThemeHelper#render_theme` --- spec/helpers/theme_helper_spec.rb | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/spec/helpers/theme_helper_spec.rb b/spec/helpers/theme_helper_spec.rb index 820c8103..1448c2fe 100644 --- a/spec/helpers/theme_helper_spec.rb +++ b/spec/helpers/theme_helper_spec.rb @@ -3,6 +3,34 @@ require "rails_helper" describe ThemeHelper, :type => :helper do + describe "#render_theme" do + context "when target page doesn't have a theme" do + it "returns no theme" do + expect(helper.render_theme).to be_nil + end + end + + context "when target page has a theme" do + before(:each) do + @user = FactoryBot.create(:user) + @user.theme = Theme.new + @user.save! + end + + it "returns a theme" do + expect(helper.render_theme).to include("