diff options
author | pluralcafe-docker <docker@plural.cafe> | 2018-08-30 05:23:58 +0000 |
---|---|---|
committer | pluralcafe-docker <docker@plural.cafe> | 2018-08-30 05:23:58 +0000 |
commit | cc7437e25597e24b9a5f06f7991861506d9abe5c (patch) | |
tree | e627d32df29ef7ae30a67607caf3ecdc1ae333a9 /spec/controllers/application_controller_spec.rb | |
parent | 395164add468b1079669699dfe8eeaab73f69c15 (diff) | |
parent | 5ce67276691c37baad149f2f89f765543f70e6f9 (diff) |
Merge branch 'glitch'
Diffstat (limited to 'spec/controllers/application_controller_spec.rb')
-rw-r--r-- | spec/controllers/application_controller_spec.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb index c6c78d3f7..2603688be 100644 --- a/spec/controllers/application_controller_spec.rb +++ b/spec/controllers/application_controller_spec.rb @@ -92,6 +92,43 @@ describe ApplicationController, type: :controller do end end + describe 'helper_method :current_flavour' do + it 'returns "glitch" when theme wasn\'t changed in admin settings' do + allow(Setting).to receive(:default_settings).and_return({'skin' => 'default'}) + allow(Setting).to receive(:default_settings).and_return({'flavour' => 'glitch'}) + + expect(controller.view_context.current_flavour).to eq 'glitch' + end + + it 'returns instances\'s flavour when user is not signed in' do + allow(Setting).to receive(:[]).with('skin').and_return 'default' + allow(Setting).to receive(:[]).with('flavour').and_return 'vanilla' + + expect(controller.view_context.current_flavour).to eq 'vanilla' + end + + it 'returns instances\'s default flavour when user didn\'t set theme' do + current_user = Fabricate(:user) + sign_in current_user + + allow(Setting).to receive(:[]).with('skin').and_return 'default' + allow(Setting).to receive(:[]).with('flavour').and_return 'vanilla' + + expect(controller.view_context.current_flavour).to eq 'vanilla' + end + + it 'returns user\'s flavour when it is set' do + current_user = Fabricate(:user) + current_user.settings['flavour'] = 'glitch' + sign_in current_user + + allow(Setting).to receive(:[]).with('skin').and_return 'default' + allow(Setting).to receive(:[]).with('flavour').and_return 'vanilla' + + expect(controller.view_context.current_flavour).to eq 'glitch' + end + end + context 'ActionController::RoutingError' do subject do routes.draw { get 'routing_error' => 'anonymous#routing_error' } |