test/test_rest_methods.rb in myjohndeere-0.0.2 vs test/test_rest_methods.rb in myjohndeere-0.0.3
- old
+ new
@@ -22,9 +22,22 @@
organizations = MyJohnDeere::Organization.list(default_access_token, count: 1, etag: "")
assert_equal "something", organizations.etag
end
+ def test_build_resource_base_path
+ resource_path = "blah"
+ assert_equal "blah", MyJohnDeere::Organization.build_resource_base_path!("blah", {})
+ resource_path = "blah%{x_id}"
+ options = {x: 5, x_id: 1}
+ assert_equal "blah1", MyJohnDeere::Organization.build_resource_base_path!(resource_path, options)
+ assert_equal({x: 5}, options)
+
+ assert_raises ArgumentError do
+ MyJohnDeere::Organization.build_resource_base_path!(resource_path, {})
+ end
+ end
+
def test_list_with_body
stub_request(:get, /organizations;start=0;count=1/).
with(query: {embed: "boundaries"}).
to_return(status: 200, body: LIST_FIXTURE.to_json())
organizations = MyJohnDeere::Organization.list(default_access_token, count: 1, etag: "", body: {embed: "boundaries"})
\ No newline at end of file