diff options
| author | Christian Höltje <docwhat@gerf.org> | 2013-06-03 11:31:35 -0400 |
|---|---|---|
| committer | Christian Höltje <docwhat@gerf.org> | 2013-06-03 11:39:46 -0400 |
| commit | 336750c916498e99505f593067d4eeadccb3c261 (patch) | |
| tree | 43d6125b1d1efe1326ab9be8de4aafe8ea28df78 /spec/helpers | |
| parent | 0447c731ba392641145ac53cb8c50fab5392cda7 (diff) | |
| download | gitlab-ce-336750c916498e99505f593067d4eeadccb3c261.tar.gz | |
user_color_scheme_class with current_user
This refactors the `user_color_scheme_class` to use
a hash with a default. This prevents problems
with workers that don't have access to the
current_user.
Fixes issue #2758
Diffstat (limited to 'spec/helpers')
| -rw-r--r-- | spec/helpers/application_helper_spec.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index ba1af08421b..229f49659cf 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -83,4 +83,26 @@ describe ApplicationHelper do end end + + describe "user_color_scheme_class" do + context "with current_user is nil" do + it "should return a string" do + stub!(:current_user).and_return(nil) + user_color_scheme_class.should be_kind_of(String) + end + end + + context "with a current_user" do + (1..5).each do |color_scheme_id| + context "with color_scheme_id == #{color_scheme_id}" do + it "should return a string" do + current_user = double(:color_scheme_id => color_scheme_id) + stub!(:current_user).and_return(current_user) + user_color_scheme_class.should be_kind_of(String) + end + end + end + end + end + end |
