Commit a3f6dbbe authored by Thong Kuah's avatar Thong Kuah

Merge branch 'refactor-package-graphql-specs-license' into 'master'

Refactor package graphql specs

See merge request gitlab-org/gitlab!38521
parents c0d09dd9 04c1f740
...@@ -28,42 +28,40 @@ RSpec.describe 'getting a package list for a project' do ...@@ -28,42 +28,40 @@ RSpec.describe 'getting a package list for a project' do
) )
end end
context 'without the need for a license' do context 'when user has access to the project' do
context 'when user has access to the project' do before do
before do project.add_reporter(current_user)
project.add_reporter(current_user) post_graphql(query, current_user: current_user)
post_graphql(query, current_user: current_user) end
end
it_behaves_like 'a working graphql query' it_behaves_like 'a working graphql query'
it 'returns packages successfully' do it 'returns packages successfully' do
expect(packages_data[0]['node']['name']).to eq package.name expect(packages_data[0]['node']['name']).to eq package.name
end
end end
end
context 'when the user does not have access to the project/packages' do context 'when the user does not have access to the project/packages' do
before do before do
post_graphql(query, current_user: current_user) post_graphql(query, current_user: current_user)
end end
it_behaves_like 'a working graphql query' it_behaves_like 'a working graphql query'
it 'returns nil' do it 'returns nil' do
expect(graphql_data['project']).to be_nil expect(graphql_data['project']).to be_nil
end
end end
end
context 'when the user is not autenthicated' do context 'when the user is not autenthicated' do
before do before do
post_graphql(query) post_graphql(query)
end end
it_behaves_like 'a working graphql query' it_behaves_like 'a working graphql query'
it 'returns nil' do it 'returns nil' do
expect(graphql_data['project']).to be_nil expect(graphql_data['project']).to be_nil
end
end end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment