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
)
end
context 'without the need for a license' do
context 'when user has access to the project' do
before do
project.add_reporter(current_user)
post_graphql(query, current_user: current_user)
end
context 'when user has access to the project' do
before do
project.add_reporter(current_user)
post_graphql(query, current_user: current_user)
end
it_behaves_like 'a working graphql query'
it_behaves_like 'a working graphql query'
it 'returns packages successfully' do
expect(packages_data[0]['node']['name']).to eq package.name
end
it 'returns packages successfully' do
expect(packages_data[0]['node']['name']).to eq package.name
end
end
context 'when the user does not have access to the project/packages' do
before do
post_graphql(query, current_user: current_user)
end
context 'when the user does not have access to the project/packages' do
before do
post_graphql(query, current_user: current_user)
end
it_behaves_like 'a working graphql query'
it_behaves_like 'a working graphql query'
it 'returns nil' do
expect(graphql_data['project']).to be_nil
end
it 'returns nil' do
expect(graphql_data['project']).to be_nil
end
end
context 'when the user is not autenthicated' do
before do
post_graphql(query)
end
context 'when the user is not autenthicated' do
before do
post_graphql(query)
end
it_behaves_like 'a working graphql query'
it_behaves_like 'a working graphql query'
it 'returns nil' do
expect(graphql_data['project']).to be_nil
end
it 'returns nil' do
expect(graphql_data['project']).to be_nil
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