diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 11:59:07 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 11:59:07 +0000 |
commit | 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch) | |
tree | 544930fb309b30317ae9797a9683768705d664c4 /spec/graphql/resolvers/releases_resolver_spec.rb | |
parent | 4b1de649d0168371549608993deac953eb692019 (diff) | |
download | gitlab-ce-8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca.tar.gz |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'spec/graphql/resolvers/releases_resolver_spec.rb')
-rw-r--r-- | spec/graphql/resolvers/releases_resolver_spec.rb | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/spec/graphql/resolvers/releases_resolver_spec.rb b/spec/graphql/resolvers/releases_resolver_spec.rb index b9b90686aa7..89623be891f 100644 --- a/spec/graphql/resolvers/releases_resolver_spec.rb +++ b/spec/graphql/resolvers/releases_resolver_spec.rb @@ -17,6 +17,7 @@ RSpec.describe Resolvers::ReleasesResolver do let_it_be(:public_user) { create(:user) } let(:args) { { sort: :released_at_desc } } + let(:all_releases) { [release_v1, release_v2, release_v3] } before do project.add_developer(developer) @@ -27,7 +28,7 @@ RSpec.describe Resolvers::ReleasesResolver do let(:current_user) { public_user } it 'returns an empty array' do - expect(resolve_releases).to eq([]) + expect(resolve_releases).to be_empty end end @@ -35,7 +36,7 @@ RSpec.describe Resolvers::ReleasesResolver do let(:current_user) { developer } it 'returns all releases associated to the project' do - expect(resolve_releases).to eq([release_v3, release_v2, release_v1]) + expect(resolve_releases).to match_array(all_releases) end describe 'sorting behavior' do @@ -43,7 +44,9 @@ RSpec.describe Resolvers::ReleasesResolver do let(:args) { { sort: :released_at_desc } } it 'returns the releases ordered by released_at in descending order' do - expect(resolve_releases).to eq([release_v3, release_v2, release_v1]) + expect(resolve_releases.to_a) + .to match_array(all_releases) + .and be_sorted(:released_at, :desc) end end @@ -51,7 +54,9 @@ RSpec.describe Resolvers::ReleasesResolver do let(:args) { { sort: :released_at_asc } } it 'returns the releases ordered by released_at in ascending order' do - expect(resolve_releases).to eq([release_v1, release_v2, release_v3]) + expect(resolve_releases.to_a) + .to match_array(all_releases) + .and be_sorted(:released_at, :asc) end end @@ -59,7 +64,9 @@ RSpec.describe Resolvers::ReleasesResolver do let(:args) { { sort: :created_desc } } it 'returns the releases ordered by created_at in descending order' do - expect(resolve_releases).to eq([release_v1, release_v3, release_v2]) + expect(resolve_releases.to_a) + .to match_array(all_releases) + .and be_sorted(:created_at, :desc) end end @@ -67,7 +74,9 @@ RSpec.describe Resolvers::ReleasesResolver do let(:args) { { sort: :created_asc } } it 'returns the releases ordered by created_at in ascending order' do - expect(resolve_releases).to eq([release_v2, release_v3, release_v1]) + expect(resolve_releases.to_a) + .to match_array(all_releases) + .and be_sorted(:created_at, :asc) end end end |