Fixed issue with invalid type checking.
git-svn-id: https://google-api-ruby-client.googlecode.com/svn/trunk@51 c1d61fac-ed7f-fcc1-18f7-ff78120a04ef
This commit is contained in:
1 parent
638f8a810c
commit
e50442091c
3 files changed
+90
-10
No files matched your search
@@ -160,7 +160,7 @@ describe Google::APIClient, 'configured for the prediction API' do
|
||||
@client.latest_service('bogus').should == nil
|
||||
end
|
||||
|
||||
it 'should generate requests against the correct URIs' do
|
||||
it 'should generate valid requests' do
|
||||
request = @client.generate_request(
|
||||
'prediction.training.insert',
|
||||
{'query' => '12345'},
|
||||
@@ -169,13 +169,30 @@ describe Google::APIClient, 'configured for the prediction API' do
|
||||
{:signed => false}
|
||||
)
|
||||
method, uri, headers, body = request
|
||||
method.should == 'POST'
|
||||
uri.should ==
|
||||
'https://www.googleapis.com/prediction/v1/training?query=12345'
|
||||
Hash[headers].should == {}
|
||||
body.should respond_to(:each)
|
||||
end
|
||||
|
||||
it 'should generate requests against the correct URIs' do
|
||||
request = @client.generate_request(
|
||||
:'prediction.training.insert',
|
||||
{'query' => '12345'},
|
||||
'',
|
||||
[],
|
||||
{:signed => false}
|
||||
)
|
||||
method, uri, headers, body = request
|
||||
uri.should ==
|
||||
'https://www.googleapis.com/prediction/v1/training?query=12345'
|
||||
end
|
||||
|
||||
it 'should generate requests against the correct URIs' do
|
||||
prediction = @client.discovered_service('prediction', 'v1')
|
||||
request = @client.generate_request(
|
||||
:'prediction.training.insert',
|
||||
prediction.training.insert,
|
||||
{'query' => '12345'},
|
||||
'',
|
||||
[],
|
||||
@@ -221,6 +238,12 @@ describe Google::APIClient, 'configured for the prediction API' do
|
||||
@client.generate_request(42)
|
||||
end).should raise_error(TypeError)
|
||||
end
|
||||
|
||||
it 'should raise an error for bogus methods' do
|
||||
(lambda do
|
||||
@client.generate_request(@client.discovered_service('prediction'))
|
||||
end).should raise_error(TypeError)
|
||||
end
|
||||
end
|
||||
|
||||
describe Google::APIClient, 'configured for the buzz API' do
|
||||
|
||||
Reference in new issue
Block a user