Sha256: 587cfeee21e17c7a0575039d32ffaf1d278ef972c60ff09a0439e49d4e4810f2
Contents?: true
Size: 1.39 KB
Versions: 2
Compression:
Stored size: 1.39 KB
Contents
require "defile" RSpec.describe Defile do let(:io) { StringIO.new("hello") } describe ".verify_uploadable" do it "works if it conforms to required API" do expect(Defile.verify_uploadable(double(size: 444, read: io, eof?: true, close: nil), nil)).to be_truthy end it "raises ArgumentError if argument does not respond to `size`" do expect { Defile.verify_uploadable(double(read: io, eof?: true, close: nil), nil) }.to raise_error(ArgumentError) end it "raises ArgumentError if argument does not respond to `read`" do expect { Defile.verify_uploadable(double(size: 444, eof?: true, close: nil), nil) }.to raise_error(ArgumentError) end it "raises ArgumentError if argument does not respond to `eof?`" do expect { Defile.verify_uploadable(double(size: 444, read: true, close: nil), nil) }.to raise_error(ArgumentError) end it "raises ArgumentError if argument does not respond to `close`" do expect { Defile.verify_uploadable(double(size: 444, read: true, eof?: true), nil) }.to raise_error(ArgumentError) end it "returns true if size is respeced" do expect(Defile.verify_uploadable(Defile::FileDouble.new("hello"), 8)).to be_truthy end it "raises Defile::Invalid if size is exceeded" do expect { Defile.verify_uploadable(Defile::FileDouble.new("hello world"), 8) }.to raise_error(Defile::Invalid) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
defile-0.2.1 | spec/defile_spec.rb |
defile-0.2.0 | spec/defile_spec.rb |