summaryrefslogtreecommitdiff
path: root/spec/requests/api/graphql/mutations/releases
diff options
context:
space:
mode:
Diffstat (limited to 'spec/requests/api/graphql/mutations/releases')
-rw-r--r--spec/requests/api/graphql/mutations/releases/create_spec.rb22
-rw-r--r--spec/requests/api/graphql/mutations/releases/update_spec.rb10
2 files changed, 9 insertions, 23 deletions
diff --git a/spec/requests/api/graphql/mutations/releases/create_spec.rb b/spec/requests/api/graphql/mutations/releases/create_spec.rb
index d745eb3083d..79bdcec7944 100644
--- a/spec/requests/api/graphql/mutations/releases/create_spec.rb
+++ b/spec/requests/api/graphql/mutations/releases/create_spec.rb
@@ -116,11 +116,9 @@ RSpec.describe 'Creation of a new release' do
context 'when all available mutation arguments are provided' do
it_behaves_like 'no errors'
- # rubocop: disable CodeReuse/ActiveRecord
it 'returns the new release data' do
create_release
- release = mutation_response[:release]
expected_direct_asset_url = Gitlab::Routing.url_helpers.project_release_url(project, Release.find_by(tag: tag_name)) << "/downloads#{asset_link[:directAssetPath]}"
expected_attributes = {
@@ -139,21 +137,17 @@ RSpec.describe 'Creation of a new release' do
directAssetUrl: expected_direct_asset_url
}]
}
+ },
+ milestones: {
+ nodes: [
+ { title: '12.3' },
+ { title: '12.4' }
+ ]
}
- }
-
- expect(release).to include(expected_attributes)
+ }.with_indifferent_access
- # Right now the milestones are returned in a non-deterministic order.
- # This `milestones` test should be moved up into the expect(release)
- # above (and `.to include` updated to `.to eq`) once
- # https://gitlab.com/gitlab-org/gitlab/-/issues/259012 is addressed.
- expect(release['milestones']['nodes']).to match_array([
- { 'title' => '12.4' },
- { 'title' => '12.3' }
- ])
+ expect(mutation_response[:release]).to eq(expected_attributes)
end
- # rubocop: enable CodeReuse/ActiveRecord
end
context 'when only the required mutation arguments are provided' do
diff --git a/spec/requests/api/graphql/mutations/releases/update_spec.rb b/spec/requests/api/graphql/mutations/releases/update_spec.rb
index 19320c3393c..c9a6c3abd57 100644
--- a/spec/requests/api/graphql/mutations/releases/update_spec.rb
+++ b/spec/requests/api/graphql/mutations/releases/update_spec.rb
@@ -116,15 +116,7 @@ RSpec.describe 'Updating an existing release' do
it 'updates the correct field and returns the release' do
update_release
- expect(mutation_response[:release]).to include(expected_attributes.merge(updates).except(:milestones))
-
- # Right now the milestones are returned in a non-deterministic order.
- # Because of this, we need to test milestones separately to allow
- # for them to be returned in any order.
- # Once https://gitlab.com/gitlab-org/gitlab/-/issues/259012 has been
- # fixed, this special milestone handling can be removed.
- expected_milestones = expected_attributes.merge(updates)[:milestones]
- expect(mutation_response[:release][:milestones][:nodes]).to match_array(expected_milestones[:nodes])
+ expect(mutation_response[:release]).to eq(expected_attributes.merge(updates))
end
end