Sha256: 75c98f72a7942ae976e76a70f5aa39e843aa33926030f4226f3f1ec381249529
Contents?: true
Size: 1.26 KB
Versions: 2
Compression:
Stored size: 1.26 KB
Contents
require 'spec_helper' require 'xploy/error' require 'xploy/api/request/body' describe Xploy::Api::Request::Body do context 'unknown file type' do let('path') { 'foo/bar' } before do File.stub('exists?').with(path).and_return(true) end subject { described_class.new path } its('path') { should eq path } it { expect{subject.mime_type}.to raise_error(Xploy::ManifestFileTypeUnsupported) } it { expect{subject.read}.to raise_error(Xploy::ManifestFileTypeUnsupported) } end context 'known file type but not existent' do let('path') { 'foo/bar.json' } before do File.stub('exists?').with(path).and_return(false) end subject { described_class.new path } its('path') { should eq path } its('mime_type') { should eq 'application/json' } it { expect{subject.read}.to raise_error(Xploy::ManifestFileNotFound) } end context 'correct file' do let('path') { 'foo/bar.json' } before do File.stub('exists?').with(path).and_return(true) File.stub('read').with(path).and_return('example data') end subject { described_class.new path } its('path') { should eq path } its('mime_type') { should eq 'application/json' } its('read') { should eq 'example data' } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
xploy-0.1.1.beta | spec/lib/xploy/api/request/body_spec.rb |
xploy-0.1.0.beta | spec/lib/xploy/api/request/body_spec.rb |