schneems/opro — pull request #9 by robe5 (2012-08-08 09:59:11+00:00)
Title: fix OauthGrant#expired? for auth_grants created before Opro.require_refr...

...esh_within is setted

Hi again!

I was playing again with your gem and just discovered a bug.

You can reproduce it by commenting `config.require_refresh_within` var in an app initializer, creating an AuthGrant and then setting `config.require_refresh_withint` to some value.

This produce an error because the `AuthGrant::access_token_expires_at` is nil and `AuthGrant#expired?` raises an error:

NoMethodError (undefined method `<' for false:FalseClass):

I have created a unit test. I don't know if you like this aproach or you'd prefer that auth_grants always generate an access_token expiration time and only check it later in `expired?` if `::Opro.require_refresh_within.present?`. Anyway, here you have a pull request if you consider it is appropiate :)

Cheers!

PS: Sorry for my english.