Skip to content

Commit 726c467

Browse files
committed
Update Specs
1 parent 4c442e8 commit 726c467

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

spec/dynamics_nav_spec.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,28 +46,28 @@ module OData
4646
results.first.should be_a_kind_of(Customer)
4747
end
4848

49-
it "should return an error if a customer is accessed with integer id" do
49+
it "should successfully return a customer by its string id" do
5050
svc = OData::Service.new "http://test.com/nav.svc/", { :username => username, :password => password, :verify_ssl => false }
51-
byebug
52-
svc.Customer(100013)
53-
expect { svc.execute }.to raise_error(OData::ServiceError) { |error|
54-
error.http_code.should eq 400
55-
error.message.should eq "Server returned error but no message."
56-
}
51+
svc.Customer('100013')
52+
results = svc.execute
53+
results.first.should be_a_kind_of(Customer)
54+
results.first.Name.should eq 'Contoso AG'
5755
end
5856

59-
it "should successfully return a customer by its string id" do
57+
it "should cast to string if a customer is accessed with integer id" do
6058
svc = OData::Service.new "http://test.com/nav.svc/", { :username => username, :password => password, :verify_ssl => false }
61-
svc.Customer('100013')
59+
svc.Customer(100013)
6260
results = svc.execute
6361
results.first.should be_a_kind_of(Customer)
62+
results.first.Name.should eq 'Contoso AG'
6463
end
6564

6665
it "should successfully return a sales_order by its composite string ids" do
6766
svc = OData::Service.new "http://test.com/nav.svc/", { :username => username, :password => password, :verify_ssl => false }
6867
svc.SalesOrder(Document_Type: 'Order', No: 'AB-1600013')
6968
results = svc.execute
70-
results.first.should be_a_kind_of(Customer)
69+
results.first.should be_a_kind_of(SalesOrder)
70+
results.first.No.should eq 'AB-1600013'
7171
end
7272

7373
end

0 commit comments

Comments
 (0)