diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-08-26 00:31:33 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-08-26 01:32:38 +0300 |
commit | 4344b8d2d4367b19c6849c3cab0d02d17ddf2304 (patch) | |
tree | acdd4182f3fecac6c22fb1cfb783cb987ad87001 /spec/lib/gitlab/color_schemes_spec.rb | |
parent | 429c0d14918d8727eac0e24ff01df5cdf55b2f79 (diff) |
Add Gitlab::ColorSchemes module
Very similar to Gitlab::Theme, this contains all of the definitions for
our syntax highlighting schemes.
Diffstat (limited to 'spec/lib/gitlab/color_schemes_spec.rb')
-rw-r--r-- | spec/lib/gitlab/color_schemes_spec.rb | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/spec/lib/gitlab/color_schemes_spec.rb b/spec/lib/gitlab/color_schemes_spec.rb new file mode 100644 index 00000000000..c7be45dbcd3 --- /dev/null +++ b/spec/lib/gitlab/color_schemes_spec.rb @@ -0,0 +1,45 @@ +require 'spec_helper' + +describe Gitlab::ColorSchemes do + describe '.body_classes' do + it 'returns a space-separated list of class names' do + css = described_class.body_classes + + expect(css).to include('white') + expect(css).to include(' solarized-light ') + expect(css).to include(' monokai') + end + end + + describe '.by_id' do + it 'returns a scheme by its ID' do + expect(described_class.by_id(1).name).to eq 'White' + expect(described_class.by_id(4).name).to eq 'Solarized Dark' + end + end + + describe '.default' do + it 'returns the default scheme' do + expect(described_class.default.id).to eq 1 + end + end + + describe '.each' do + it 'passes the block to the SCHEMES Array' do + ids = [] + described_class.each { |scheme| ids << scheme.id } + expect(ids).not_to be_empty + end + end + + describe '.for_user' do + it 'returns default when user is nil' do + expect(described_class.for_user(nil).id).to eq 1 + end + + it "returns user's preferred color scheme" do + user = double(color_scheme_id: 5) + expect(described_class.for_user(user).id).to eq 5 + end + end +end |