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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
06736132
Commit
06736132
authored
Apr 14, 2017
by
Luke "Jared" Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated units
parent
13b60eb7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
96 additions
and
84 deletions
+96
-84
app/assets/javascripts/raven/index.js
app/assets/javascripts/raven/index.js
+10
-6
app/assets/javascripts/raven/raven_config.js
app/assets/javascripts/raven/raven_config.js
+1
-3
spec/javascripts/raven/index_spec.js
spec/javascripts/raven/index_spec.js
+3
-3
spec/javascripts/raven/raven_config_spec.js
spec/javascripts/raven/raven_config_spec.js
+82
-72
No files found.
app/assets/javascripts/raven/index.js
View file @
06736132
import
RavenConfig
from
'
./raven_config
'
;
import
RavenConfig
from
'
./raven_config
'
;
const
index
=
RavenConfig
.
init
.
bind
(
RavenConfig
,
{
const
index
=
function
index
()
{
sentryDsn
:
gon
.
sentry_dsn
,
RavenConfig
.
init
({
currentUserId
:
gon
.
current_user_id
,
sentryDsn
:
gon
.
sentry_dsn
,
whitelistUrls
:
[
gon
.
gitlab_url
],
currentUserId
:
gon
.
current_user_id
,
isProduction
:
gon
.
is_production
,
whitelistUrls
:
[
gon
.
gitlab_url
],
});
isProduction
:
gon
.
is_production
,
});
return
RavenConfig
;
};
index
();
index
();
...
...
app/assets/javascripts/raven/raven_config.js
View file @
06736132
...
@@ -8,8 +8,6 @@ const RavenConfig = {
...
@@ -8,8 +8,6 @@ const RavenConfig = {
this
.
configure
();
this
.
configure
();
this
.
bindRavenErrors
();
this
.
bindRavenErrors
();
if
(
this
.
options
.
currentUserId
)
this
.
setUser
();
if
(
this
.
options
.
currentUserId
)
this
.
setUser
();
return
this
;
},
},
configure
()
{
configure
()
{
...
@@ -44,6 +42,6 @@ const RavenConfig = {
...
@@ -44,6 +42,6 @@ const RavenConfig = {
},
},
});
});
},
},
}
}
;
export
default
RavenConfig
;
export
default
RavenConfig
;
spec/javascripts/raven/index_spec.js
View file @
06736132
import
RavenConfig
from
'
~/raven/raven_config
'
;
import
RavenConfig
from
'
~/raven/raven_config
'
;
import
index
from
'
~/raven/index
'
;
import
index
from
'
~/raven/index
'
;
f
describe
(
'
RavenConfig options
'
,
()
=>
{
describe
(
'
RavenConfig options
'
,
()
=>
{
let
sentryDsn
;
let
sentryDsn
;
let
currentUserId
;
let
currentUserId
;
let
gitlabUrl
;
let
gitlabUrl
;
...
@@ -21,13 +21,13 @@ fdescribe('RavenConfig options', () => {
...
@@ -21,13 +21,13 @@ fdescribe('RavenConfig options', () => {
is_production
:
isProduction
,
is_production
:
isProduction
,
};
};
spyOn
(
RavenConfig
.
init
,
'
bind
'
);
spyOn
(
RavenConfig
,
'
init
'
);
indexReturnValue
=
index
();
indexReturnValue
=
index
();
});
});
it
(
'
should init with .sentryDsn, .currentUserId, .whitelistUrls and .isProduction
'
,
()
=>
{
it
(
'
should init with .sentryDsn, .currentUserId, .whitelistUrls and .isProduction
'
,
()
=>
{
expect
(
RavenConfig
.
init
.
bind
).
toHaveBeenCalledWith
(
RavenConfig
,
{
expect
(
RavenConfig
.
init
).
toHaveBeenCalledWith
(
{
sentryDsn
,
sentryDsn
,
currentUserId
,
currentUserId
,
whitelistUrls
:
[
gitlabUrl
],
whitelistUrls
:
[
gitlabUrl
],
...
...
spec/javascripts/raven/raven_config_spec.js
View file @
06736132
import
$
from
'
jquery
'
;
import
Raven
from
'
raven-js
'
;
import
Raven
from
'
raven-js
'
;
import
RavenConfig
from
'
~/raven/raven_config
'
;
import
RavenConfig
from
'
~/raven/raven_config
'
;
describe
(
'
RavenConfig
'
,
()
=>
{
f
describe
(
'
RavenConfig
'
,
()
=>
{
describe
(
'
init
'
,
()
=>
{
describe
(
'
init
'
,
()
=>
{
let
options
;
beforeEach
(()
=>
{
beforeEach
(()
=>
{
options
=
{
sentryDsn
:
'
//sentryDsn
'
,
ravenAssetUrl
:
'
//ravenAssetUrl
'
,
currentUserId
:
1
,
whitelistUrls
:
[
'
//gitlabUrl
'
],
isProduction
:
true
,
};
spyOn
(
RavenConfig
,
'
configure
'
);
spyOn
(
RavenConfig
,
'
configure
'
);
spyOn
(
RavenConfig
,
'
bindRavenErrors
'
);
spyOn
(
RavenConfig
,
'
bindRavenErrors
'
);
spyOn
(
RavenConfig
,
'
setUser
'
);
spyOn
(
RavenConfig
,
'
setUser
'
);
});
describe
(
'
when called
'
,
()
=>
{
let
options
;
beforeEach
(()
=>
{
RavenConfig
.
init
(
options
);
options
=
{
});
sentryDsn
:
'
//sentryDsn
'
,
ravenAssetUrl
:
'
//ravenAssetUrl
'
,
currentUserId
:
1
,
whitelistUrls
:
[
'
//gitlabUrl
'
],
isProduction
:
true
,
};
RavenConfig
.
init
(
options
);
});
it
(
'
should set the options property
'
,
()
=>
{
it
(
'
should set the options property
'
,
()
=>
{
expect
(
RavenConfig
.
options
).
toEqual
(
options
);
expect
(
RavenConfig
.
options
).
toEqual
(
options
);
});
});
it
(
'
should call the configure method
'
,
()
=>
{
it
(
'
should call the configure method
'
,
()
=>
{
expect
(
RavenConfig
.
configure
).
toHaveBeenCalled
();
expect
(
RavenConfig
.
configure
).
toHaveBeenCalled
();
});
});
it
(
'
should call the error bindings method
'
,
()
=>
{
it
(
'
should call the error bindings method
'
,
()
=>
{
expect
(
RavenConfig
.
bindRavenErrors
).
toHaveBeenCalled
();
expect
(
RavenConfig
.
bindRavenErrors
).
toHaveBeenCalled
();
});
});
it
(
'
should call setUser
'
,
()
=>
{
it
(
'
should call setUser
'
,
()
=>
{
expect
(
RavenConfig
.
setUser
).
toHaveBeenCalled
();
expect
(
RavenConfig
.
setUser
).
toHaveBeenCalled
();
});
});
});
it
(
'
should not call setUser if there is no current user ID
'
,
()
=>
{
it
(
'
should not call setUser if there is no current user ID
'
,
()
=>
{
RavenConfig
.
setUser
.
calls
.
reset
();
RavenConfig
.
init
({
RavenConfig
.
init
({
sentryDsn
:
'
//sentryDsn
'
,
sentryDsn
:
'
//sentryDsn
'
,
ravenAssetUrl
:
'
//ravenAssetUrl
'
,
ravenAssetUrl
:
'
//ravenAssetUrl
'
,
...
@@ -55,72 +54,83 @@ describe('RavenConfig', () => {
...
@@ -55,72 +54,83 @@ describe('RavenConfig', () => {
});
});
describe
(
'
configure
'
,
()
=>
{
describe
(
'
configure
'
,
()
=>
{
describe
(
'
when called
'
,
()
=>
{
let
options
;
let
options
;
let
raven
;
let
raven
;
beforeEach
(()
=>
{
beforeEach
(()
=>
{
options
=
{
options
=
{
sentryDsn
:
'
//sentryDsn
'
,
sentryDsn
:
'
//sentryDsn
'
,
whitelistUrls
:
[
'
//gitlabUrl
'
],
whitelistUrls
:
[
'
//gitlabUrl
'
],
isProduction
:
true
,
isProduction
:
true
,
};
};
raven
=
jasmine
.
createSpyObj
(
'
raven
'
,
[
'
install
'
]);
raven
=
jasmine
.
createSpyObj
(
'
raven
'
,
[
'
install
'
]);
spyOn
(
Raven
,
'
config
'
).
and
.
returnValue
(
raven
);
spyOn
(
Raven
,
'
config
'
).
and
.
returnValue
(
raven
);
spyOn
(
Raven
,
'
install
'
);
RavenConfig
.
configure
.
call
({
RavenConfig
.
configure
.
call
({
options
,
options
,
});
});
});
});
it
(
'
should call Raven.config
'
,
()
=>
{
it
(
'
should call Raven.config
'
,
()
=>
{
expect
(
Raven
.
config
).
toHaveBeenCalledWith
(
options
.
sentryDsn
,
{
expect
(
Raven
.
config
).
toHaveBeenCalledWith
(
options
.
sentryDsn
,
{
whitelistUrls
:
options
.
whitelistUrls
,
whitelistUrls
:
options
.
whitelistUrls
,
environment
:
'
production
'
,
environment
:
'
production
'
,
});
});
});
});
it
(
'
should call Raven.install
'
,
()
=>
{
it
(
'
should call Raven.install
'
,
()
=>
{
expect
(
Raven
.
install
).
toHaveBeenCalled
();
expect
(
raven
.
install
).
toHaveBeenCalled
();
});
it
(
'
should set .environment to development if isProduction is false
'
,
()
=>
{
options
.
isProduction
=
false
;
RavenConfig
.
configure
.
call
({
options
,
});
});
describe
(
'
if isProduction is false
'
,
()
=>
{
expect
(
Raven
.
config
).
toHaveBeenCalledWith
(
options
.
sentryDsn
,
{
beforeEach
(()
=>
{
whitelistUrls
:
options
.
whitelistUrls
,
options
.
isProduction
=
false
;
environment
:
'
development
'
,
RavenConfig
.
configure
.
call
({
options
,
});
});
it
(
'
should set .environment to development
'
,
()
=>
{
expect
(
Raven
.
config
).
toHaveBeenCalledWith
(
options
.
sentryDsn
,
{
whitelistUrls
:
options
.
whitelistUrls
,
environment
:
'
development
'
,
});
});
});
});
});
});
});
});
describe
(
'
setUser
'
,
()
=>
{
describe
(
'
setUser
'
,
()
=>
{
describe
(
'
when called
'
,
()
=>
{
let
ravenConfig
;
beforeEach
(()
=>
{});
beforeEach
(()
=>
{
ravenConfig
=
{
options
:
{
currentUserId
:
1
}
};
spyOn
(
Raven
,
'
setUserContext
'
);
RavenConfig
.
setUser
.
call
(
ravenConfig
);
});
it
(
'
should call .setUserContext
'
,
function
()
{
expect
(
Raven
.
setUserContext
).
toHaveBeenCalledWith
({
id
:
ravenConfig
.
options
.
currentUserId
,
});
});
});
});
});
describe
(
'
bindRavenErrors
'
,
()
=>
{
describe
(
'
bindRavenErrors
'
,
()
=>
{
describe
(
'
when called
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{});
RavenConfig
.
bindRavenErrors
();
});
it
(
'
should query for document using jquery
'
,
()
=>
{
console
.
log
(
$
,
'
or
'
,
$
.
fn
);
// expect($).toHaveBeenCalledWith()
});
it
(
'
should call .on
'
,
function
()
{
// expect($document.on).toHaveBeenCalledWith('ajaxError.raven', RavenConfig.handleRavenErrors);
});
});
});
});
describe
(
'
handleRavenErrors
'
,
()
=>
{
describe
(
'
handleRavenErrors
'
,
()
=>
{
describe
(
'
when called
'
,
()
=>
{
beforeEach
(()
=>
{});
beforeEach
(()
=>
{});
});
});
});
});
});
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