diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-06 15:10:29 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-06 15:10:29 +0300 |
commit | 5564275a0b378298dc6281599cbfe71a937109ff (patch) | |
tree | a468e1e60046356410219c35c23a8a428c5e2c5e /spec/lib/gitlab/tab_width_spec.rb | |
parent | d87918510a866a5fcbbc2f899ad65c6938ebf5f5 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/tab_width_spec.rb')
-rw-r--r-- | spec/lib/gitlab/tab_width_spec.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/lib/gitlab/tab_width_spec.rb b/spec/lib/gitlab/tab_width_spec.rb new file mode 100644 index 00000000000..3b5014d27e4 --- /dev/null +++ b/spec/lib/gitlab/tab_width_spec.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +require 'fast_spec_helper' + +describe Gitlab::TabWidth, lib: true do + describe '.css_class_for_user' do + it 'returns default CSS class when user is nil' do + css_class = described_class.css_class_for_user(nil) + + expect(css_class).to eq('tab-width-8') + end + + it "returns CSS class for user's tab width", :aggregate_failures do + [1, 6, 12].each do |i| + user = double('user', tab_width: i) + css_class = described_class.css_class_for_user(user) + + expect(css_class).to eq("tab-width-#{i}") + end + end + + it 'raises if tab width is out of valid range', :aggregate_failures do + [0, 13, 'foo', nil].each do |i| + expect do + user = double('user', tab_width: i) + described_class.css_class_for_user(user) + end.to raise_error(ArgumentError) + end + end + end +end |