Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2015-06-13 03:39:48 +0300
committerRobert Speicher <rspeicher@gmail.com>2015-06-14 00:59:13 +0300
commitd2894a39e5b3a8504cb290a2f41b0aac5fc8b0a8 (patch)
tree12278e2507b6fa301da9b62cf76da3b7e53ebcc8 /spec/helpers
parentc0cb77e413fa38625a96323a527ff4dc56d59573 (diff)
Refactor dashboard_choices
Diffstat (limited to 'spec/helpers')
-rw-r--r--spec/helpers/preferences_helper_spec.rb18
1 files changed, 10 insertions, 8 deletions
diff --git a/spec/helpers/preferences_helper_spec.rb b/spec/helpers/preferences_helper_spec.rb
index 32a9593cc03..920de8c4325 100644
--- a/spec/helpers/preferences_helper_spec.rb
+++ b/spec/helpers/preferences_helper_spec.rb
@@ -32,18 +32,20 @@ describe PreferencesHelper do
describe 'dashboard_choices' do
it 'raises an exception when defined choices may be missing' do
- dashboards = User.dashboards
- expect(User).to receive(:dashboards).
- and_return(dashboards.merge(foo: 'foo'))
+ expect(User).to receive(:dashboards).and_return(foo: 'foo')
+ expect { dashboard_choices }.to raise_error(RuntimeError)
+ end
- expect { dashboard_choices }.to raise_error
+ it 'raises an exception when defined choices may be using the wrong key' do
+ expect(User).to receive(:dashboards).and_return(foo: 'foo', bar: 'bar')
+ expect { dashboard_choices }.to raise_error(KeyError)
end
it 'provides better option descriptions' do
- choices = dashboard_choices
-
- expect(choices[0]).to eq ['Your Projects (default)', 'projects']
- expect(choices[1]).to eq ['Starred Projects', 'stars']
+ expect(dashboard_choices).to match_array [
+ ['Your Projects (default)', 'projects'],
+ ['Starred Projects', 'stars']
+ ]
end
end