summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorWinnie Hellmann <winnie@gitlab.com>2019-07-12 06:31:17 +0000
committerJan Provaznik <jprovaznik@gitlab.com>2019-07-12 06:31:17 +0000
commit2e6225538f6e065dda61c04c9c9e76fbe0b23646 (patch)
tree2de903022b2e9fd9a1b97d6dfb72276c31384a51 /spec
parent4c6bdd23b32940bc1687ef7879821cd8772340b2 (diff)
downloadgitlab-ce-2e6225538f6e065dda61c04c9c9e76fbe0b23646.tar.gz
Split and prepend CurrentBoardEntity
(cherry picked from commit 1e8bdd01bff96122fe80c51fa8f024f18675b58b)
Diffstat (limited to 'spec')
-rw-r--r--spec/fixtures/api/schemas/current-board.json16
-rw-r--r--spec/helpers/boards_helper_spec.rb16
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