diff options
author | Toon Claes <toon@gitlab.com> | 2019-02-06 16:08:30 +0100 |
---|---|---|
committer | Toon Claes <toon@gitlab.com> | 2019-02-06 16:31:05 +0100 |
commit | 327a0154d2c696f820b40eb96a3c3e16fbb6ff0a (patch) | |
tree | 24aad55d58e2490859b823727af0640c33040ecd | |
parent | cdd0f6f557e3d43cac6d988c774e151d79c7b101 (diff) | |
download | gitlab-ce-fabsrc/gitlab-ce-2105-add-setting-for-first-day-of-the-week.tar.gz |
Add specs for first_day_of_week helpersfabsrc/gitlab-ce-2105-add-setting-for-first-day-of-the-week
-rw-r--r-- | spec/helpers/preferences_helper_spec.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/helpers/preferences_helper_spec.rb b/spec/helpers/preferences_helper_spec.rb index c112c8ed633..ae872e0a29b 100644 --- a/spec/helpers/preferences_helper_spec.rb +++ b/spec/helpers/preferences_helper_spec.rb @@ -35,6 +35,40 @@ describe PreferencesHelper do end end + describe '#first_day_of_week_choices' do + it 'has Sunday and Monday' do + expect(helper.first_day_of_week_choices.first).to eq(['Sunday', 0]) + expect(helper.first_day_of_week_choices.second).to eq(['Monday', 1]) + end + end + + describe '#default_first_day_of_week' do + it 'returns the system default' do + stub_application_setting(first_day_of_week: 1) + + expect(helper.default_first_day_of_week).to eq('Monday') + end + end + + describe '#first_day_of_week_choices_with_default' do + it 'has 3 options' do + expect(helper.first_day_of_week_choices_with_default.count).to eq(3) + end + + it 'first item is System default' do + default = helper.first_day_of_week_choices_with_default.first + + expect(default).to be_a(Array) + expect(default.first).to match(/^System default/) + expect(default.first).to match(helper.default_first_day_of_week) + expect(default.last).to be_nil + end + + it 'contains #first_day_of_week_choices' do + expect(helper.first_day_of_week_choices_with_default).to include(*helper.first_day_of_week_choices) + end + end + describe '#user_application_theme' do context 'with a user' do it "returns user's theme's css_class" do |