spec/send_letter_spec.rb in postalmethods-1.0.0 vs spec/send_letter_spec.rb in postalmethods-1.0.1

- old
+ new

@@ -1,18 +1,17 @@ require File.dirname(__FILE__) + '/spec_helper.rb' describe "Send Letter" do before :each do - @doc = open(File.dirname(__FILE__) + '/../doc/sample.pdf') + @doc = open(File.dirname(__FILE__) + '/../spec/doc/sample.pdf') @client = PostalMethods::Client.new(PM_OPTS) end it "should instantiate and send a letter" do @client.prepare! - rv = @client.send_letter(@doc, "the long goodbye") - rv.sendLetterResult.to_i.should > 0 + rv = @client.send_letter(@doc, "the long goodbye").should > 0 end it "should refuse to send letter before prepare" do lambda {@client.send_letter(@doc, "the long goodbye")}.should raise_error(PostalMethods::NoPreparationException) end @@ -36,40 +35,39 @@ end describe "Send Letter With Address" do before :each do - @doc = open(File.dirname(__FILE__) + '/../doc/sample.pdf') + @doc = open(File.dirname(__FILE__) + '/../spec/doc/sample.pdf') @addr = {:AttentionLine1 => "The Fonz", :Address1 => "Happy Days", :City => "Baja", :State => "CA", :PostalCode => "90210", :Country => "USA"} @client = PostalMethods::Client.new(PM_OPTS) end it "should instantiate and send a letter with address" do @client.prepare! - rv = @client.send_letter_and_address(@doc, "Shark Jumping Notes", @addr) - rv.sendLetterAndAddressResult.to_i.should > 0 + rv = @client.send_letter_with_address(@doc, "Shark Jumping Notes", @addr).should > 0 end it "should raise the proper exception when trying to send letter without valid attention line" do @client.prepare! addr = @addr.except(:AttentionLine1) - lambda {@client.send_letter_and_address(@doc, "the long goodbye", addr)}.should raise_error(PostalMethods::APIStatusCode4008Exception) + lambda {@client.send_letter_with_address(@doc, "the long goodbye", addr)}.should raise_error(PostalMethods::APIStatusCode4008Exception) end it "should refuse to send letter before prepare" do - lambda {@client.send_letter_and_address(@doc, "the long goodbye", @addr)}.should raise_error(PostalMethods::NoPreparationException) + lambda {@client.send_letter_with_address(@doc, "the long goodbye", @addr)}.should raise_error(PostalMethods::NoPreparationException) end it "should raise the proper exception when trying to send textfile" do @doc = open(File.dirname(__FILE__) + '/../README.txt') @client.prepare! - lambda {@client.send_letter_and_address(@doc, "the long goodbye", @addr)}.should raise_error(PostalMethods::APIStatusCode3004Exception) + lambda {@client.send_letter_with_address(@doc, "the long goodbye", @addr)}.should raise_error(PostalMethods::APIStatusCode3004Exception) end it "should raise the proper exception when trying to send an empty string" do @client.prepare! - lambda {@client.send_letter_and_address("", "the long goodbye", @addr)}.should raise_error(Errno::ENOENT) + lambda {@client.send_letter_with_address("", "the long goodbye", @addr)}.should raise_error(Errno::ENOENT) end end