diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-25 21:08:10 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-25 21:08:10 +0300 |
commit | 5d75b2b9a9d11c20667895e6aa68ea4e76658c5d (patch) | |
tree | 2aa529b0a153c805f5f4ecb357321a4e4f4c59cb /spec/requests/api/releases_spec.rb | |
parent | 6f2065c468b05658125b746169c56764a8ccddb1 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests/api/releases_spec.rb')
-rw-r--r-- | spec/requests/api/releases_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/requests/api/releases_spec.rb b/spec/requests/api/releases_spec.rb index e66e999dc27..0589554bf44 100644 --- a/spec/requests/api/releases_spec.rb +++ b/spec/requests/api/releases_spec.rb @@ -6,6 +6,7 @@ describe API::Releases do let(:project) { create(:project, :repository, :private) } let(:maintainer) { create(:user) } let(:reporter) { create(:user) } + let(:developer) { create(:user) } let(:guest) { create(:user) } let(:non_project_member) { create(:user) } let(:commit) { create(:commit, project: project) } @@ -15,6 +16,7 @@ describe API::Releases do project.add_maintainer(maintainer) project.add_reporter(reporter) project.add_guest(guest) + project.add_developer(developer) project.repository.add_tag(maintainer, 'v0.1', commit.id) project.repository.add_tag(maintainer, 'v0.2', commit.id) @@ -248,6 +250,24 @@ describe API::Releases do .to match_array(release.sources.map(&:url)) end + context 'with evidence' do + let!(:evidence) { create(:evidence, release: release) } + + it 'returns the evidence' do + get api("/projects/#{project.id}/releases/v0.1", maintainer) + + expect(json_response['evidences'].count).to eq(1) + end + + it '#collected_at' do + Timecop.freeze(Time.now.round) do + get api("/projects/#{project.id}/releases/v0.1", maintainer) + + expect(json_response['evidences'].first['collected_at'].to_datetime.to_i).to be_within(1.minute).of(release.evidences.first.created_at.to_i) + end + end + end + context 'when release has link asset' do let!(:link) do create(:release_link, |