summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-02-06 11:18:30 +0000
committerRémy Coutable <remy@rymai.me>2017-02-06 11:18:30 +0000
commitda359c46b598ba44cff1829ab4abe49c4c225ae2 (patch)
tree3e1a3c328f2f18304e7caa637f23c5807a1e57d9 /spec
parent572fb0be9b1d45437b7c0ed1000399657f471ec7 (diff)
parentf5de8f159e9fb79ed523fcb41c4b062eeaf3f811 (diff)
downloadgitlab-ce-da359c46b598ba44cff1829ab4abe49c4c225ae2.tar.gz
Merge branch 'api-fix-files' into 'master'
API: Fix file downloading See merge request !8953
Diffstat (limited to 'spec')
-rw-r--r--spec/requests/api/builds_spec.rb1
-rw-r--r--spec/support/matchers/match_file.rb5
2 files changed, 6 insertions, 0 deletions
diff --git a/spec/requests/api/builds_spec.rb b/spec/requests/api/builds_spec.rb
index f197fadebab..834c4e52693 100644
--- a/spec/requests/api/builds_spec.rb
+++ b/spec/requests/api/builds_spec.rb
@@ -188,6 +188,7 @@ describe API::Builds, api: true do
it 'returns specific job artifacts' do
expect(response).to have_http_status(200)
expect(response.headers).to include(download_headers)
+ expect(response.body).to match_file(build.artifacts_file.file.file)
end
end
diff --git a/spec/support/matchers/match_file.rb b/spec/support/matchers/match_file.rb
new file mode 100644
index 00000000000..d1888b3376a
--- /dev/null
+++ b/spec/support/matchers/match_file.rb
@@ -0,0 +1,5 @@
+RSpec::Matchers.define :match_file do |expected|
+ match do |actual|
+ expect(Digest::MD5.hexdigest(actual)).to eq(Digest::MD5.hexdigest(File.read(expected)))
+ end
+end