songkick/oauth2-provider — pull request #40 by dplummer (2012-08-14 17:33:29+00:00)
Title: Fix bug in find_or_create_for_client

The test was failing because a validation was failing on the
authorization generated by find_or_create_by_client_id. The reason is
that you validate_presence_of :client, but you are doing
find_or_create_by_client_id, so the :client attribute is not set and
validation fails.

Solution is to just set the client and owner in the find_or_create block
that ActiveRecord provides.