summaryrefslogtreecommitdiff
path: root/spec/models/ci/artifact_blob_spec.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-05-02 17:42:37 -0500
committerDouwe Maan <douwe@selenight.nl>2017-05-04 08:50:12 -0500
commit0f58eb6bde35009b69ef871534d9ff80fc38bbf7 (patch)
tree0a5065d9fc05822a81a9379f5a6a64f8105f9503 /spec/models/ci/artifact_blob_spec.rb
parent4faa65d8381f3e1e45bdf3a9bc9785b588891b66 (diff)
downloadgitlab-ce-0f58eb6bde35009b69ef871534d9ff80fc38bbf7.tar.gz
Add artifact file page that uses the blob viewerdm-artifact-blob-viewer
Diffstat (limited to 'spec/models/ci/artifact_blob_spec.rb')
-rw-r--r--spec/models/ci/artifact_blob_spec.rb44
1 files changed, 44 insertions, 0 deletions
diff --git a/spec/models/ci/artifact_blob_spec.rb b/spec/models/ci/artifact_blob_spec.rb
new file mode 100644
index 00000000000..968593d7e9b
--- /dev/null
+++ b/spec/models/ci/artifact_blob_spec.rb
@@ -0,0 +1,44 @@
+require 'spec_helper'
+
+describe Ci::ArtifactBlob, models: true do
+ let(:build) { create(:ci_build, :artifacts) }
+ let(:entry) { build.artifacts_metadata_entry('other_artifacts_0.1.2/another-subdirectory/banana_sample.gif') }
+
+ subject { described_class.new(entry) }
+
+ describe '#id' do
+ it 'returns a hash of the path' do
+ expect(subject.id).to eq(Digest::SHA1.hexdigest(entry.path))
+ end
+ end
+
+ describe '#name' do
+ it 'returns the entry name' do
+ expect(subject.name).to eq(entry.name)
+ end
+ end
+
+ describe '#path' do
+ it 'returns the entry path' do
+ expect(subject.path).to eq(entry.path)
+ end
+ end
+
+ describe '#size' do
+ it 'returns the entry size' do
+ expect(subject.size).to eq(entry.metadata[:size])
+ end
+ end
+
+ describe '#mode' do
+ it 'returns the entry mode' do
+ expect(subject.mode).to eq(entry.metadata[:mode])
+ end
+ end
+
+ describe '#external_storage' do
+ it 'returns :build_artifact' do
+ expect(subject.external_storage).to eq(:build_artifact)
+ end
+ end
+end