diff options
author | Luke Bennett <lukeeeebennettplus@gmail.com> | 2017-12-03 20:46:49 +0000 |
---|---|---|
committer | Luke Bennett <lukeeeebennettplus@gmail.com> | 2017-12-03 20:46:49 +0000 |
commit | 5e01ae5a92ff4876ba63c8cfb186b97197a42052 (patch) | |
tree | 94291627b386c69dc1c3b62ca49825c2725e24ac | |
parent | e63d73cfa0e78ae96602a1a1838236abe2471a1b (diff) | |
download | gitlab-ce-5e01ae5a92ff4876ba63c8cfb186b97197a42052.tar.gz |
add boards_helper_spec
-rw-r--r-- | spec/controllers/projects/boards_controller_spec.rb | 6 | ||||
-rw-r--r-- | spec/helpers/boards_helper_spec.rb | 21 |
2 files changed, 27 insertions, 0 deletions
diff --git a/spec/controllers/projects/boards_controller_spec.rb b/spec/controllers/projects/boards_controller_spec.rb index 78dc4e68ad8..d6ccb92c54b 100644 --- a/spec/controllers/projects/boards_controller_spec.rb +++ b/spec/controllers/projects/boards_controller_spec.rb @@ -65,6 +65,12 @@ describe Projects::BoardsController do describe 'GET show' do let!(:board) { create(:board, project: project) } + it 'sets boards_endpoint instance variable to a boards path' do + read_board board: board + + expect(assigns(:boards_endpoint)).to eq project_boards_path(project) + end + context 'when format is HTML' do it 'renders template' do read_board board: board diff --git a/spec/helpers/boards_helper_spec.rb b/spec/helpers/boards_helper_spec.rb new file mode 100644 index 00000000000..a3c5ab99c87 --- /dev/null +++ b/spec/helpers/boards_helper_spec.rb @@ -0,0 +1,21 @@ +require 'spec_helper' + +describe BoardsHelper do + describe '#board_data' do + let(:user) { create(:user) } + let(:project) { create(:project) } + let(:board) { create(:board, project: project) } + + before do + assign(:board, board) + assign(:project, project) + + allow(helper).to receive(:current_user) { user } + allow(helper).to receive(:can?).with(user, :admin_list, project).and_return(true) + end + + it 'returns a board_lists_path as lists_endpoint' do + expect(helper.board_data[:lists_endpoint]).to eq(board_lists_path(board)) + end + end +end |