Skip to content
Browse files

Fix condition where error was returning a string rather than raising

  • Loading branch information...
1 parent 437c8ae commit b014eda0ca6d29206f67285f05aae91fc2ad6763 @kyledrake kyledrake committed Apr 16, 2012
Showing with 10 additions and 2 deletions.
  1. +1 −1 lib/geoloqi/session.rb
  2. +1 −1 lib/geoloqi/version.rb
  3. +4 −0 spec/geoloqi/config_spec.rb
  4. +4 −0 spec/geoloqi/session_spec.rb
View
2 lib/geoloqi/session.rb
@@ -215,7 +215,7 @@ def batch(&block)
# @see #get_auth
# @see #application_access_token
def establish(opts={})
- require 'client_id and client_secret are required to get access token' unless @config.client_id? && @config.client_secret?
+ raise Error, 'client_id and client_secret are required to get access token' unless @config.client_id? && @config.client_secret?
auth = post 'oauth/token', {:client_id => @config.client_id,
:client_secret => @config.client_secret}.merge!(opts)
View
2 lib/geoloqi/version.rb
@@ -3,6 +3,6 @@ module Geoloqi
#
# @return [String]
def self.version
- '0.9.39'
+ '0.9.40'
end
end
View
4 spec/geoloqi/config_spec.rb
@@ -1,6 +1,10 @@
require File.join File.dirname(__FILE__), '..', 'env.rb'
describe Geoloqi::Config do
+ after do
+ Geoloqi.config({})
+ end
+
describe 'with redirect_uri' do
it 'returns authorize url' do
Geoloqi.config :client_id => CLIENT_ID, :client_secret => CLIENT_SECRET, :redirect_uri => 'http://blah.blah/test'
View
4 spec/geoloqi/session_spec.rb
@@ -96,6 +96,10 @@ class NotFoundError < ApiError; end
before do
@session = Geoloqi::Session.new :access_token => ACCESS_TOKEN
end
+
+ it 'fails with establish without client_id and client_secret' do
+ lambda { @session.establish }.must_raise Geoloqi::Error
+ end
it 'successfully makes a batch request' do
stub_request(:post, api_url('batch/run')).

0 comments on commit b014eda

Please sign in to comment.
Something went wrong with that request. Please try again.