Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
c16d5bcd
Commit
c16d5bcd
authored
Nov 05, 2016
by
winniehell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move Ajax interceptor into describe block (!7304)
parent
50f3fd49
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
116 additions
and
108 deletions
+116
-108
spec/javascripts/boards/boards_store_spec.js.es6
spec/javascripts/boards/boards_store_spec.js.es6
+109
-106
spec/javascripts/boards/list_spec.js.es6
spec/javascripts/boards/list_spec.js.es6
+5
-0
spec/javascripts/boards/mock_data.js.es6
spec/javascripts/boards/mock_data.js.es6
+2
-2
No files found.
spec/javascripts/boards/boards_store_spec.js.es6
View file @
c16d5bcd
...
@@ -13,8 +13,9 @@
...
@@ -13,8 +13,9 @@
//= require boards/stores/boards_store
//= require boards/stores/boards_store
//= require ./mock_data
//= require ./mock_data
(
() => {
describe('Store',
() => {
beforeEach(() => {
beforeEach(() => {
Vue.http.interceptors.push(boardsMockInterceptor);
gl.boardService = new BoardService('/test/issue-boards/board', '1');
gl.boardService = new BoardService('/test/issue-boards/board', '1');
gl.issueBoards.BoardsStore.create();
gl.issueBoards.BoardsStore.create();
...
@@ -24,7 +25,10 @@
...
@@ -24,7 +25,10 @@
});
});
});
});
describe('Store', () => {
afterEach(() => {
Vue.http.interceptors = _.without(Vue.http.interceptors, boardsMockInterceptor);
});
it('starts with a blank state', () => {
it('starts with a blank state', () => {
expect(gl.issueBoards.BoardsStore.state.lists.length).toBe(0);
expect(gl.issueBoards.BoardsStore.state.lists.length).toBe(0);
});
});
...
@@ -164,5 +168,4 @@
...
@@ -164,5 +168,4 @@
}, 0);
}, 0);
});
});
});
});
});
});
})();
spec/javascripts/boards/list_spec.js.es6
View file @
c16d5bcd
...
@@ -17,12 +17,17 @@ describe('List model', () => {
...
@@ -17,12 +17,17 @@ describe('List model', () => {
let list;
let list;
beforeEach(() => {
beforeEach(() => {
Vue.http.interceptors.push(boardsMockInterceptor);
gl.boardService = new BoardService('/test/issue-boards/board', '1');
gl.boardService = new BoardService('/test/issue-boards/board', '1');
gl.issueBoards.BoardsStore.create();
gl.issueBoards.BoardsStore.create();
list = new List(listObj);
list = new List(listObj);
});
});
afterEach(() => {
Vue.http.interceptors = _.without(Vue.http.interceptors, boardsMockInterceptor);
});
it('gets issues when created', (done) => {
it('gets issues when created', (done) => {
setTimeout(() => {
setTimeout(() => {
expect(list.issues.length).toBe(1);
expect(list.issues.length).toBe(1);
...
...
spec/javascripts/boards/mock_data.js.es6
View file @
c16d5bcd
...
@@ -48,10 +48,10 @@ const BoardsMockData = {
...
@@ -48,10 +48,10 @@ const BoardsMockData = {
}
}
};
};
Vue.http.interceptors.push(
(request, next) => {
const boardsMockInterceptor =
(request, next) => {
const body = BoardsMockData[request.method][request.url];
const body = BoardsMockData[request.method][request.url];
next(request.respondWith(JSON.stringify(body), {
next(request.respondWith(JSON.stringify(body), {
status: 200
status: 200
}));
}));
}
)
;
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment