diff options
| author | Douwe Maan <douwe@gitlab.com> | 2015-08-27 16:24:51 +0000 |
|---|---|---|
| committer | Douwe Maan <douwe@gitlab.com> | 2015-08-27 16:24:51 +0000 |
| commit | 30555c1d24af25aca0c6e85f52234a8a570b7691 (patch) | |
| tree | fd40fb02e465ae97db65d9e3fb89ba26bd8237ee /spec/lib | |
| parent | abb5b9f6e526195c4eb027d5b7c28e070d9ac3c1 (diff) | |
| parent | ce0a0feff45b47b6c03b9ab01d815b651840a7b2 (diff) | |
| download | gitlab-ce-30555c1d24af25aca0c6e85f52234a8a570b7691.tar.gz | |
Merge branch 'rs-remove-user-color-scheme-class' into 'master'
Apply syntax highlighting to fenced code blocks client-side
Instead of applying the syntax highlighting scheme class to these blocks
server-side, we use Javascript and Gon to apply the user's color scheme
(or the default) client-side.
This will make it easier to cache these blocks in the future because
they're no longer state-dependent.
See merge request !1203
Diffstat (limited to 'spec/lib')
| -rw-r--r-- | spec/lib/gitlab/color_schemes_spec.rb | 45 | ||||
| -rw-r--r-- | spec/lib/gitlab/themes_spec.rb | 3 |
2 files changed, 45 insertions, 3 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 diff --git a/spec/lib/gitlab/themes_spec.rb b/spec/lib/gitlab/themes_spec.rb index 9c6c3fd8104..e554458e41c 100644 --- a/spec/lib/gitlab/themes_spec.rb +++ b/spec/lib/gitlab/themes_spec.rb @@ -43,9 +43,6 @@ describe Gitlab::Themes do ids = [] described_class.each { |theme| ids << theme.id } expect(ids).not_to be_empty - - # TODO (rspeicher): RSpec 3.x - # expect(described_class.each).to yield_with_arg(described_class::Theme) end end end |
