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
Boxiang Sun
gitlab-ce
Commits
d09034ac
Commit
d09034ac
authored
Jul 25, 2018
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add pull request spec
parent
771dec84
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
79 additions
and
0 deletions
+79
-0
spec/lib/bitbucket_server/representation/pull_request_spec.rb
.../lib/bitbucket_server/representation/pull_request_spec.rb
+79
-0
No files found.
spec/lib/bitbucket_server/representation/pull_request_spec.rb
0 → 100644
View file @
d09034ac
require
'spec_helper'
describe
BitbucketServer
::
Representation
::
PullRequest
do
let
(
:sample_data
)
{
JSON
.
parse
(
fixture_file
(
'importers/bitbucket_server/pull_request.json'
))
}
subject
{
described_class
.
new
(
sample_data
)
}
describe
'#author'
do
it
{
expect
(
subject
.
author
).
to
eq
(
'root'
)
}
end
describe
'#author_email'
do
it
{
expect
(
subject
.
author_email
).
to
eq
(
'joe.montana@49ers.com'
)
}
end
describe
'#description'
do
it
{
expect
(
subject
.
description
).
to
eq
(
'Test'
)
}
end
describe
'#iid'
do
it
{
expect
(
subject
.
iid
).
to
eq
(
7
)
}
end
describe
'#state'
do
it
{
expect
(
subject
.
state
).
to
eq
(
'merged'
)
}
context
'declined pull requests'
do
before
do
sample_data
[
'state'
]
=
'DECLINED'
end
it
'returns closed'
do
expect
(
subject
.
state
).
to
eq
(
'closed'
)
end
end
context
'open pull requests'
do
before
do
sample_data
[
'state'
]
=
'OPEN'
end
it
'returns open'
do
expect
(
subject
.
state
).
to
eq
(
'opened'
)
end
end
end
describe
'#merged?'
do
it
{
expect
(
subject
.
merged?
).
to
be_truthy
}
end
describe
'#created_at'
do
it
{
expect
(
subject
.
created_at
).
to
eq
(
Time
.
parse
(
'2018-07-02 23:50:35'
))
}
end
describe
'#updated_at'
do
it
{
expect
(
subject
.
updated_at
).
to
eq
(
Time
.
parse
(
'2018-07-02 23:50:48'
))
}
end
describe
'#title'
do
it
{
expect
(
subject
.
title
).
to
eq
(
'Added a new line'
)
}
end
describe
'#source_branch_name'
do
it
{
expect
(
subject
.
source_branch_name
).
to
eq
(
'refs/heads/root/CODE_OF_CONDUCTmd-1530600625006'
)
}
end
describe
'#source_branch_sha'
do
it
{
expect
(
subject
.
source_branch_sha
).
to
eq
(
'074e2b4dddc5b99df1bf9d4a3f66cfc15481fdc8'
)
}
end
describe
'#target_branch_name'
do
it
{
expect
(
subject
.
target_branch_name
).
to
eq
(
'refs/heads/master'
)
}
end
describe
'#target_branch_sha'
do
it
{
expect
(
subject
.
target_branch_sha
).
to
eq
(
'839fa9a2d434eb697815b8fcafaecc51accfdbbc'
)
}
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