Permalink
Browse files

Oauth2Token.find was looking for an ID, so use Oauth2Token.first instead

Also use color in the RSpec output
  • Loading branch information...
1 parent fa8c375 commit 1852ddfcf3b4aecf15e1c93798d36ad2e848f859 Rémy Coutable committed with Jul 18, 2011
Showing with 3 additions and 3 deletions.
  1. +1 −1 Guardfile
  2. +1 −1 lib/oauth/rack/oauth_filter.rb
  3. +1 −1 spec/rack/oauth_filter_spec.rb
View
@@ -1,7 +1,7 @@
# A sample Guardfile
# More info at http://github.com/guard/guard#readme
-guard 'rspec', :version => 2 do
+guard 'rspec', :version => 2, :cli => '-c' do
watch(%r{^spec/(.*)_spec.rb})
watch(%r{^lib/oauth/(.+)\.rb}) { |m| "spec/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
@@ -24,7 +24,7 @@ def call(env)
env["oauth_plugin"] = true
strategies = []
if token_string = oauth2_token(request)
- if token = Oauth2Token.find(:conditions => ['invalidated_at IS NULL AND authorized_at IS NOT NULL and token = ?', token_string])
+ if token = Oauth2Token.first(:conditions => ['invalidated_at IS NULL AND authorized_at IS NOT NULL and token = ?', token_string])
env["oauth.token"] = token
env["oauth.version"] = 2
strategies << :oauth20_token
@@ -199,7 +199,7 @@ def secret
class OauthToken
attr_accessor :token
- def self.find(conditions_hash)
+ def self.first(conditions_hash)
case conditions_hash[:conditions].last
when "not_authorized", "invalidated"
nil

0 comments on commit 1852ddf

Please sign in to comment.