diff options
author | Winnie Hellmann <winnie@gitlab.com> | 2019-07-09 13:40:36 +0200 |
---|---|---|
committer | Winnie Hellmann <winnie@gitlab.com> | 2019-07-11 19:44:12 +0200 |
commit | c304114956f6b368a4b7ef2cc8f258300054b524 (patch) | |
tree | ba30c81ba6a006088b24abc922b43ef44fec21f4 | |
parent | 26960f360b0df146fae4ae2dc568ae3a87258828 (diff) | |
download | gitlab-ce-c304114956f6b368a4b7ef2cc8f258300054b524.tar.gz |
Move current_board_json unit tests
(cherry picked from commit f966c4ba8ffbc9b9d875b8fae59ec63759c6dc37)
-rw-r--r-- | spec/fixtures/api/schemas/current-board.json | 16 | ||||
-rw-r--r-- | spec/helpers/boards_helper_spec.rb | 16 |
2 files changed, 30 insertions, 2 deletions
diff --git a/spec/fixtures/api/schemas/current-board.json b/spec/fixtures/api/schemas/current-board.json new file mode 100644 index 00000000000..2ddc038e908 --- /dev/null +++ b/spec/fixtures/api/schemas/current-board.json @@ -0,0 +1,16 @@ +{ + "type": "object", + "allOf": [ + { "$ref": "board.json" }, + { + "required" : [ + "id", + "name" + ], + "properties": { + "id": { "type": "integer" }, + "name": { "type": "string" } + } + } + ] +} diff --git a/spec/helpers/boards_helper_spec.rb b/spec/helpers/boards_helper_spec.rb index b22947911b9..f014537eb54 100644 --- a/spec/helpers/boards_helper_spec.rb +++ b/spec/helpers/boards_helper_spec.rb @@ -1,10 +1,12 @@ require 'spec_helper' describe BoardsHelper do + set(:project) { create(:project) } + describe '#build_issue_link_base' do context 'project board' do it 'returns correct path for project board' do - @project = create(:project) + @project = project @board = create(:board, project: @project) expect(build_issue_link_base).to eq("/#{@project.namespace.path}/#{@project.path}/issues") @@ -31,7 +33,6 @@ describe BoardsHelper do describe '#board_data' do let(:user) { create(:user) } - let(:project) { create(:project) } let(:board) { create(:board, project: project) } before do @@ -46,4 +47,15 @@ describe BoardsHelper do expect(helper.board_data[:lists_endpoint]).to eq(board_lists_path(board)) end end + + describe '#current_board_json' do + let(:board_json) { helper.current_board_json } + + it 'can serialise with a basic set of attributes' do + board = create(:board, project: project) + assign(:board, board) + + expect(board_json).to match_schema('current-board') + end + end end |