diff options
author | Jarka Kadlecova <jarka@gitlab.com> | 2017-03-16 16:28:14 +0300 |
---|---|---|
committer | Jarka Kadlecova <jarka@gitlab.com> | 2017-03-16 18:01:53 +0300 |
commit | 398a70f3e53b2adc90460dcc1c55bae276e12ffe (patch) | |
tree | 85cb196a6f3942ff3bbbbac3f4e59d643102351e /spec/helpers/todos_helper_spec.rb | |
parent | 68e64a5b44b7a0f540214ee8a3ca36ffcdb4fc6c (diff) |
Include routes when loading user projects
Diffstat (limited to 'spec/helpers/todos_helper_spec.rb')
-rw-r--r-- | spec/helpers/todos_helper_spec.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/helpers/todos_helper_spec.rb b/spec/helpers/todos_helper_spec.rb new file mode 100644 index 00000000000..50060a0925d --- /dev/null +++ b/spec/helpers/todos_helper_spec.rb @@ -0,0 +1,23 @@ +require "spec_helper" + +describe TodosHelper do + describe '#todo_projects_options' do + let(:projects) { create_list(:empty_project, 3) } + let(:user) { create(:user) } + + it 'returns users authorised projects in json format' do + projects.first.add_developer(user) + projects.second.add_developer(user) + + allow(helper).to receive(:current_user).and_return(user) + + expected_results = [ + { 'id' => '', 'text' => 'Any Project' }, + { 'id' => projects.second.id, 'text' => projects.second.name_with_namespace }, + { 'id' => projects.first.id, 'text' => projects.first.name_with_namespace } + ] + + expect(JSON.parse(helper.todo_projects_options)).to match_array(expected_results) + end + end +end |