Sha256: 74b4484d3dc57f36830fcb98c0883bcb00bc7b5322458952cfc1e8140ed4307d
Contents?: true
Size: 1.25 KB
Versions: 3
Compression:
Stored size: 1.25 KB
Contents
require 'spec_helper' require 'xway/error' require 'xway/api/request/body' describe Xway::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(Xway::ManifestFileTypeUnsupported) } it { expect{subject.read}.to raise_error(Xway::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(Xway::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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
xway-0.0.3.beta | spec/lib/xway/api/request/body_spec.rb |
xway-0.0.2.beta | spec/lib/xway/api/request/body_spec.rb |
xway-0.0.1.beta | spec/lib/xway/api/request/body_spec.rb |