Updating code to consistent coding style.

git-svn-id: https://google-api-ruby-client.googlecode.com/svn/trunk@15 c1d61fac-ed7f-fcc1-18f7-ff78120a04ef
This commit is contained in:
bobaman@google.com committed 2010-08-17 01:21:17 +00:00
1 parent 6331247e7a
commit e6ba0f6860
15 files changed
+168 -161

No files matched your search

+21 -21
View File
@@ -12,58 +12,58 @@
# See the License for the specific language governing permissions and
# limitations under the License.
require "spec_helper"
require 'spec_helper'
require "oauth"
require "google/api_client/auth/oauth_1"
require 'oauth'
require 'google/api_client/auth/oauth_1'
describe Google::APIClient::OAuth1, "in the default configuration" do
describe Google::APIClient::OAuth1, 'in the default configuration' do
before do
@oauth = Google::APIClient::OAuth1.new
end
it "should have the correct request_token_uri" do
it 'should have the correct request_token_uri' do
@oauth.request_token_uri.should ==
"https://www.google.com/accounts/OAuthGetRequestToken"
'https://www.google.com/accounts/OAuthGetRequestToken'
end
it "should have the correct authorization_uri" do
it 'should have the correct authorization_uri' do
@oauth.authorization_endpoint_uri.should ==
"https://www.google.com/accounts/OAuthAuthorizeToken"
'https://www.google.com/accounts/OAuthAuthorizeToken'
end
it "should have the correct access_token_uri" do
it 'should have the correct access_token_uri' do
@oauth.access_token_uri.should ==
"https://www.google.com/accounts/OAuthGetAccessToken"
'https://www.google.com/accounts/OAuthGetAccessToken'
end
it "should have the correct consumer_key" do
@oauth.consumer_key.should == "anonymous"
it 'should have the correct consumer_key' do
@oauth.consumer_key.should == 'anonymous'
end
it "should have the correct consumer_secret" do
@oauth.consumer_secret.should == "anonymous"
it 'should have the correct consumer_secret' do
@oauth.consumer_secret.should == 'anonymous'
end
it "should allow the request_token to be set manually" do
@oauth.request_token = OAuth::RequestToken.new(@oauth, "key", "secret")
@oauth.request_token.token.should == "key"
@oauth.request_token.secret.should == "secret"
it 'should allow the request_token to be set manually' do
@oauth.request_token = OAuth::RequestToken.new(@oauth, 'key', 'secret')
@oauth.request_token.token.should == 'key'
@oauth.request_token.secret.should == 'secret'
end
it "should not allow the request_token to be set to bogus value" do
it 'should not allow the request_token to be set to bogus value' do
(lambda do
@oauth.request_token = 42
end).should raise_error(TypeError)
end
end
describe Google::APIClient::OAuth1, "configured for use with bogus service" do
describe Google::APIClient::OAuth1, 'configured for use with bogus service' do
before do
@oauth = Google::APIClient::OAuth1.new(:service => :bogus)
end
it "should have the default configuration" do
it 'should have the default configuration' do
@oauth.request_token_uri.should ==
Google::APIClient::OAuth1::DEFAULTS[:request_token_uri]
@oauth.authorization_endpoint_uri.should ==
@@ -12,49 +12,49 @@
# See the License for the specific language governing permissions and
# limitations under the License.
require "spec_helper"
require 'spec_helper'
require "oauth"
require "google/api_client/auth/oauth_1"
require "addressable/uri"
require 'oauth'
require 'google/api_client/auth/oauth_1'
require 'addressable/uri'
describe Google::APIClient::OAuth1, "configured for use with Buzz" do
describe Google::APIClient::OAuth1, 'configured for use with Buzz' do
before do
@oauth = Google::APIClient::OAuth1.new(:service => :buzz)
end
it "should not have the default configuration" do
it 'should not have the default configuration' do
@oauth.authorization_endpoint_uri.should_not ==
Google::APIClient::OAuth1::DEFAULTS[:authorization_uri]
@oauth.scopes.should_not ==
Google::APIClient::OAuth1::DEFAULTS[:scopes]
end
it "should have the correct authorization_uri" do
it 'should have the correct authorization_uri' do
@oauth.authorization_endpoint_uri.should ==
"https://www.google.com/buzz/api/auth/OAuthAuthorizeToken"
'https://www.google.com/buzz/api/auth/OAuthAuthorizeToken'
end
it "should have the correct scope" do
@oauth.scopes.should include("https://www.googleapis.com/auth/buzz")
it 'should have the correct scope' do
@oauth.scopes.should include('https://www.googleapis.com/auth/buzz')
end
it "should be able to get a request token" do
it 'should be able to get a request token' do
@oauth.request_token.token.should =~ /^[a-zA-Z0-9\/\-\_\+]+$/
@oauth.request_token.secret.should =~ /^[a-zA-Z0-9\/\-\_\+]+$/
end
it "should issue only a single request token" do
it 'should issue only a single request token' do
@oauth.request_token.token.should == @oauth.request_token.token
@oauth.request_token.secret.should == @oauth.request_token.secret
end
it "should build the correct authorization URI" do
icon_uri = "http://www.google.com/images/icons/feature/padlock-g128.png"
it 'should build the correct authorization URI' do
icon_uri = 'http://www.google.com/images/icons/feature/padlock-g128.png'
uri = @oauth.authorization_uri(
:domain => @oauth.consumer_key,
:iconUrl => icon_uri,
:scope => @oauth.scopes.join(" ")
:scope => @oauth.scopes.join(' ')
)
uri.should =~
/^https:\/\/www.google.com\/buzz\/api\/auth\/OAuthAuthorizeToken/
@@ -67,6 +67,6 @@ describe Google::APIClient::OAuth1, "configured for use with Buzz" do
Regexp.new(Regexp.escape(scope))
end
end
# Not much we can do to test any further into the OAuth flow
end
@@ -12,25 +12,25 @@
# See the License for the specific language governing permissions and
# limitations under the License.
require "spec_helper"
require 'spec_helper'
require "oauth"
require "google/api_client/discovery/discovery"
require 'oauth'
require 'google/api_client/discovery/discovery'
describe Google::APIClient::Discovery, "configured for use with a service" do
describe Google::APIClient::Discovery, 'configured for use with a service' do
before do
@discovery = Google::APIClient::Discovery.new(:service => :magic)
end
it "should have the correct discovery document URI" do
it 'should have the correct discovery document URI' do
@discovery.discovery_uri.should ==
"http://www.googleapis.com/discovery/0.1/describe" +
"?api=magic&apiVersion=1.0"
'http://www.googleapis.com/discovery/0.1/describe' +
'?api=magic&apiVersion=1.0'
end
end
describe Google::APIClient::Discovery,
"configured for use with a specific service version" do
'configured for use with a specific service version' do
before do
@discovery = Google::APIClient::Discovery.new(
:service => :magic,
@@ -38,9 +38,9 @@ describe Google::APIClient::Discovery,
)
end
it "should have the correct discovery document URI" do
it 'should have the correct discovery document URI' do
@discovery.discovery_uri.should ==
"http://www.googleapis.com/discovery/0.1/describe" +
"?api=magic&apiVersion=42.0"
'http://www.googleapis.com/discovery/0.1/describe' +
'?api=magic&apiVersion=42.0'
end
end
+4 -4
View File
@@ -1,5 +1,5 @@
spec_dir = File.expand_path(File.dirname(__FILE__))
lib_dir = File.expand_path(File.join(spec_dir, "../lib"))
spec_dir = File.expand_path("..", __FILE__)
lib_dir = File.expand_path("../lib", spec_dir)
$:.unshift(lib_dir)
$:.uniq!
$LOAD_PATH.unshift(lib_dir)
$LOAD_PATH.uniq!