|
|
|
@ -102,30 +102,30 @@ module OpenProject |
|
|
|
|
theme = Themes.new_theme do |theme| |
|
|
|
|
theme.identifier = :new_theme |
|
|
|
|
end |
|
|
|
|
Themes.stub(:current_theme_identifier).and_return :new_theme |
|
|
|
|
Themes.stub(:application_theme_identifier).and_return :new_theme |
|
|
|
|
expect(Themes.current_theme).to eq theme |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "returns the default theme if configured theme wasn't found" do |
|
|
|
|
Themes.stub(:current_theme_identifier).and_return :missing_theme |
|
|
|
|
Themes.stub(:application_theme_identifier).and_return :missing_theme |
|
|
|
|
expect(Themes.current_theme).to eq Themes.default_theme |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe '.current_theme_identifier' do |
|
|
|
|
describe '.application_theme_identifier' do |
|
|
|
|
it "normalizes current theme setting to a symbol" do |
|
|
|
|
Setting.stub(:ui_theme).and_return 'new_theme' |
|
|
|
|
expect(Themes.current_theme_identifier).to eq :new_theme |
|
|
|
|
expect(Themes.application_theme_identifier).to eq :new_theme |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "returns nil for an empty string" do |
|
|
|
|
Setting.stub(:ui_theme).and_return '' |
|
|
|
|
expect(Themes.current_theme_identifier).to be_nil |
|
|
|
|
expect(Themes.application_theme_identifier).to be_nil |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "returns nil for nil" do |
|
|
|
|
Setting.stub(:ui_theme).and_return nil |
|
|
|
|
expect(Themes.current_theme_identifier).to be_nil |
|
|
|
|
expect(Themes.application_theme_identifier).to be_nil |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|