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
94b59880
Commit
94b59880
authored
Jul 06, 2020
by
Nathan Friend
Committed by
Nicolò Maria Mezzopera
Jul 06, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add branches, tags, and commit API fixtures
This commit adds new API fixtures for frontend tests.
parent
42603e9b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
97 additions
and
30 deletions
+97
-30
spec/frontend/fixtures/branches.rb
spec/frontend/fixtures/branches.rb
+34
-16
spec/frontend/fixtures/commit.rb
spec/frontend/fixtures/commit.rb
+35
-14
spec/frontend/fixtures/tags.rb
spec/frontend/fixtures/tags.rb
+28
-0
No files found.
spec/frontend/fixtures/branches.rb
View file @
94b59880
...
...
@@ -2,33 +2,51 @@
require
'spec_helper'
RSpec
.
describe
Projects
::
BranchesController
,
'(JavaScript fixtures)'
,
type: :controller
do
RSpec
.
describe
'Branches (JavaScript fixtures)'
do
include
JavaScriptFixturesHelpers
let
(
:admin
)
{
create
(
:admin
)
}
let
(
:namespace
)
{
create
(
:namespace
,
name:
'frontend-fixtures'
)}
let
(
:project
)
{
create
(
:project
,
:repository
,
namespace:
namespace
,
path:
'branches-project'
)
}
render_views
let_it_be
(
:admin
)
{
create
(
:admin
)
}
let_it_be
(
:namespace
)
{
create
(
:namespace
,
name:
'frontend-fixtures'
)}
let_it_be
(
:project
)
{
create
(
:project
,
:repository
,
namespace:
namespace
,
path:
'branches-project'
)
}
before
(
:all
)
do
clean_frontend_fixtures
(
'branches/'
)
clean_frontend_fixtures
(
'api/branches/'
)
end
before
do
sign_in
(
admin
)
after
(
:all
)
do
remove_repository
(
project
)
end
after
do
remove_repository
(
project
)
describe
Projects
::
BranchesController
,
'(JavaScript fixtures)'
,
type: :controller
do
render_views
before
do
sign_in
(
admin
)
end
it
'branches/new_branch.html'
do
get
:new
,
params:
{
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
}
expect
(
response
).
to
be_successful
end
end
it
'branches/new_branch.html'
do
get
:new
,
params:
{
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
}
describe
API
::
Branches
,
'(JavaScript fixtures)'
,
type: :request
do
include
ApiHelpers
it
'api/branches/branches.json'
do
# The search query "ma" matches a few branch names in the test
# repository with a variety of different properties, including:
# - "master": default, protected
# - "markdown": non-default, protected
# - "many_files": non-default, not protected
get
api
(
"/projects/
#{
project
.
id
}
/repository/branches?search=ma"
,
admin
)
expect
(
response
).
to
be_successful
expect
(
response
).
to
be_successful
end
end
end
spec/frontend/fixtures/commit.rb
View file @
94b59880
...
...
@@ -2,34 +2,55 @@
require
'spec_helper'
RSpec
.
describe
Projects
::
CommitController
,
'(JavaScript fixtures)'
,
type: :controller
do
RSpec
.
describe
'Commit (JavaScript fixtures)'
do
include
JavaScriptFixturesHelpers
let_it_be
(
:project
)
{
create
(
:project
,
:repository
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let
(
:commit
)
{
project
.
commit
(
"master"
)
}
render_views
let_it_be
(
:commit
)
{
project
.
commit
(
"master"
)
}
before
(
:all
)
do
clean_frontend_fixtures
(
'commit/'
)
clean_frontend_fixtures
(
'api/commits/'
)
project
.
add_maintainer
(
user
)
end
before
do
project
.
add_maintainer
(
user
)
sign_in
(
user
)
allow
(
SecureRandom
).
to
receive
(
:hex
).
and_return
(
'securerandomhex:thereisnospoon'
)
end
it
'commit/show.html'
do
params
=
{
namespace_id:
project
.
namespace
,
project_id:
project
,
id:
commit
.
id
}
after
(
:all
)
do
remove_repository
(
project
)
end
describe
Projects
::
CommitController
,
'(JavaScript fixtures)'
,
type: :controller
do
render_views
before
do
sign_in
(
user
)
end
it
'commit/show.html'
do
params
=
{
namespace_id:
project
.
namespace
,
project_id:
project
,
id:
commit
.
id
}
get
:show
,
params:
params
expect
(
response
).
to
be_successful
end
end
describe
API
::
Commits
,
'(JavaScript fixtures)'
,
type: :request
do
include
ApiHelpers
get
:show
,
params:
params
it
'api/commits/commit.json'
do
get
api
(
"/projects/
#{
project
.
id
}
/repository/commits/
#{
commit
.
id
}
"
,
user
)
expect
(
response
).
to
be_successful
expect
(
response
).
to
be_successful
end
end
end
spec/frontend/fixtures/tags.rb
0 → 100644
View file @
94b59880
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
'Tags (JavaScript fixtures)'
do
include
JavaScriptFixturesHelpers
let_it_be
(
:admin
)
{
create
(
:admin
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:repository
,
path:
'tags-project'
)
}
before
(
:all
)
do
clean_frontend_fixtures
(
'api/tags/'
)
end
after
(
:all
)
do
remove_repository
(
project
)
end
describe
API
::
Tags
,
'(JavaScript fixtures)'
,
type: :request
do
include
ApiHelpers
it
'api/tags/tags.json'
do
get
api
(
"/projects/
#{
project
.
id
}
/repository/tags"
,
admin
)
expect
(
response
).
to
be_successful
end
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