applicake/doorkeeper — pull request #272 by miyagawa (2013-08-28 17:22:05+00:00)
Title: Allow issuing multiple access_tokens for one user/application for multiple devices

This addresses #191, backported from 1.0 branch per @felipeelias

I added a spec for the flow as well, which fails without the patch:

```
> bundle exec rspec spec/requests/flows/refresh_token_spec.rb -fs
====> Doorkeeper.orm = :active_record
====> Rails version: 3.2.13
====> Ruby version: 2.0.0

Refresh Token Flow
refreshing the token with multiple sessions (devices)
client request a token after creating another token with the same user (FAILED - 1)
refreshing the token
client gets an error for invalid refresh token
client request a token with refresh token
client request a token with expired access token
client gets an error for revoked acccess token
issuing a refresh token
client gets the refresh token and refreshses it

Failures:

1) Refresh Token Flow refreshing the token with multiple sessions (devices) client request a token after creating another token with the same user
Failure/Error: should_have_json 'refresh_token', Doorkeeper::AccessToken.last.refresh_token
KeyError:
key not found: "refresh_token"
# ./spec/support/helpers/request_spec_helper.rb:47:in `fetch'
# ./spec/support/helpers/request_spec_helper.rb:47:in `should_have_json'
# ./spec/requests/flows/refresh_token_spec.rb:84:in `block (3 levels) in '

Finished in 0.47722 seconds
6 examples, 1 failure

Failed examples:

rspec ./spec/requests/flows/refresh_token_spec.rb:80 # Refresh Token Flow refreshing the token with multiple sessions (devices) client request a token after creating another token with the same user
```