Sha256: 3868edecac88e2724c2769ea761ba5a0c61e5500713f072a9ff4ec6aa39b1faa
Contents?: true
Size: 1.21 KB
Versions: 5
Compression:
Stored size: 1.21 KB
Contents
require File.dirname(__FILE__) + '/spec_helper.rb' describe "Document Processing" do before :each do @client = PostalMethods::Client.new(PM_OPTS) end it "should open a valid pre-opened document" do @client.document = open(File.dirname(__FILE__) + '/../spec/doc/sample.pdf') @client.document.class.should == Hash end it "should open a valid document path" do @client.document = File.dirname(__FILE__) + '/../spec/doc/sample.pdf' @client.document.class.should == Hash end it "should create a hash with the right elements" do @client.document = File.dirname(__FILE__) + '/../spec/doc/sample.pdf' @client.document[:extension].should == "pdf" @client.document[:bytes].length.should == 213312 @client.document[:name].should == "sample.pdf" @client.document[:file_obj].class.should == File end it "should return true on a valid document path" do @client.document = File.dirname(__FILE__) + '/../spec/doc/sample.pdf' @client.document?.should == true end it "should throw an exception on a false path" do @doc = File.dirname(__FILE__) + '/../spec/doc/does_not_exist.pdf' lambda {@client.document = @doc}.should raise_error(Errno::ENOENT) end end
Version data entries
5 entries across 5 versions & 1 rubygems