spec/utility_spec.rb in postalmethods-1.0.0 vs spec/utility_spec.rb in postalmethods-1.0.1
- old
+ new
@@ -2,11 +2,11 @@
require 'base64'
describe "Utility Methods" 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)
@client.prepare!
end
it "Should get a pdf returned for a file sent" do
@@ -18,20 +18,17 @@
(`file test_output.pdf`).should == "test_output.pdf: PDF document, version 1.3\n"
system("rm test_output.pdf")
end
it "should check for error for when there is no file yet" do
- res = @client.send_letter(@doc, "the long goodbye")
- id = res.sendLetterResult.to_i
-
+ id = @client.send_letter(@doc, "the long goodbye")
id.should > 0
- #
lambda {@client.get_pdf(id)}.should raise_error(PostalMethods::APIStatusCode3020Exception)
end
it "should get the details of a letter" do
- id = @client.send_letter(@doc, "the long goodbye").sendLetterResult.to_i
+ id = @client.send_letter(@doc, "the long goodbye").to_i
sleep(10) # because it's a tired little clients
details = @client.get_letter_details(id)
# check the return...
details.should be_an_instance_of(Array)
@@ -47,10 +44,10 @@
sleep(6) # got to wait 6 seconds...
lambda { @client.get_letter_details(1)}.should raise_error(PostalMethods::APIStatusCode3001Exception)
end
it "should cancel delivery of a letter" do
- id = @client.send_letter(@doc, "the long goodbye").sendLetterResult.to_i
+ id = @client.send_letter(@doc, "the long goodbye")
rv = @client.cancel_delivery(id)
rv.should be_true
end
it "should raise an error when trying to cancel an invalid letter" do
\ No newline at end of file