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
085337a1
Commit
085337a1
authored
Nov 29, 2019
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add missing spec for fogbugz importer
Adds missing spec for fogbugz importer
parent
eefa6f35
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
73 additions
and
0 deletions
+73
-0
spec/lib/gitlab/fogbugz_import/importer_spec.rb
spec/lib/gitlab/fogbugz_import/importer_spec.rb
+73
-0
No files found.
spec/lib/gitlab/fogbugz_import/importer_spec.rb
0 → 100644
View file @
085337a1
# frozen_string_literal: true
require
'spec_helper'
describe
Gitlab
::
FogbugzImport
::
Importer
do
let
(
:project
)
{
create
(
:project_empty_repo
)
}
let
(
:importer
)
{
described_class
.
new
(
project
)
}
let
(
:repo
)
do
instance_double
(
Gitlab
::
FogbugzImport
::
Repository
,
safe_name:
'vim'
,
path:
'vim'
,
raw_data:
''
)
end
let
(
:import_data
)
{
{
'repo'
=>
repo
}
}
let
(
:credentials
)
do
{
'fb_session'
=>
{
'uri'
=>
'https://testing.fogbugz.com'
,
'token'
=>
'token'
}
}
end
let
(
:closed_bug
)
do
{
fOpen:
'false'
,
sTitle:
'Closed bug'
,
sLatestTextSummary:
""
,
dtOpened:
Time
.
now
.
to_s
,
dtLastUpdated:
Time
.
now
.
to_s
,
events:
{
event:
[]
}
}.
with_indifferent_access
end
let
(
:opened_bug
)
do
{
fOpen:
'true'
,
sTitle:
'Opened bug'
,
sLatestTextSummary:
""
,
dtOpened:
Time
.
now
.
to_s
,
dtLastUpdated:
Time
.
now
.
to_s
,
events:
{
event:
[]
}
}.
with_indifferent_access
end
let
(
:fogbugz_bugs
)
{
[
opened_bug
,
closed_bug
]
}
before
do
project
.
create_import_data
(
data:
import_data
,
credentials:
credentials
)
allow_any_instance_of
(
::
Fogbugz
::
Interface
).
to
receive
(
:command
).
with
(
:listCategories
).
and_return
([])
allow_any_instance_of
(
Gitlab
::
FogbugzImport
::
Client
).
to
receive
(
:cases
).
and_return
(
fogbugz_bugs
)
end
it
'imports bugs'
do
expect
{
importer
.
execute
}.
to
change
{
Issue
.
count
}.
by
(
2
)
end
it
'imports opened bugs'
do
importer
.
execute
issue
=
Issue
.
where
(
project_id:
project
.
id
).
find_by_title
(
opened_bug
[
:sTitle
])
expect
(
issue
.
state_id
).
to
eq
(
Issue
.
available_states
[
:opened
])
end
it
'imports closed bugs'
do
importer
.
execute
issue
=
Issue
.
where
(
project_id:
project
.
id
).
find_by_title
(
closed_bug
[
:sTitle
])
expect
(
issue
.
state_id
).
to
eq
(
Issue
.
available_states
[
:closed
])
end
end
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