anjlab-devise-oauth2-providable 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. data/.gitignore +40 -0
  2. data/.rvmrc +1 -0
  3. data/CONTRIBUTORS.txt +6 -0
  4. data/Gemfile +8 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +158 -0
  7. data/Rakefile +5 -0
  8. data/app/controllers/devise/oauth2_providable/authorizations_controller.rb +58 -0
  9. data/app/controllers/devise/oauth2_providable/tokens_controller.rb +19 -0
  10. data/app/models/devise/oauth2_providable/access_token.rb +24 -0
  11. data/app/models/devise/oauth2_providable/authorization_code.rb +4 -0
  12. data/app/models/devise/oauth2_providable/client.rb +24 -0
  13. data/app/models/devise/oauth2_providable/refresh_token.rb +7 -0
  14. data/app/views/devise/oauth2_providable/authorizations/_form.html.erb +7 -0
  15. data/app/views/devise/oauth2_providable/authorizations/error.html.erb +4 -0
  16. data/app/views/devise/oauth2_providable/authorizations/new.html.erb +4 -0
  17. data/config/routes.rb +9 -0
  18. data/db/migrate/20111014160714_create_devise_oauth2_providable_schema.rb +55 -0
  19. data/devise_oauth2_providable.gemspec +30 -0
  20. data/lib/anjlab-devise-oauth2-providable.rb +1 -0
  21. data/lib/devise/oauth2_providable/engine.rb +16 -0
  22. data/lib/devise/oauth2_providable/expirable_token.rb +57 -0
  23. data/lib/devise/oauth2_providable/models/oauth2_authorization_code_grantable.rb +6 -0
  24. data/lib/devise/oauth2_providable/models/oauth2_password_grantable.rb +6 -0
  25. data/lib/devise/oauth2_providable/models/oauth2_providable.rb +14 -0
  26. data/lib/devise/oauth2_providable/models/oauth2_refresh_token_grantable.rb +6 -0
  27. data/lib/devise/oauth2_providable/strategies/oauth2_authorization_code_grant_type_strategy.rb +21 -0
  28. data/lib/devise/oauth2_providable/strategies/oauth2_grant_type_strategy.rb +38 -0
  29. data/lib/devise/oauth2_providable/strategies/oauth2_password_grant_type_strategy.rb +22 -0
  30. data/lib/devise/oauth2_providable/strategies/oauth2_providable_strategy.rb +25 -0
  31. data/lib/devise/oauth2_providable/strategies/oauth2_refresh_token_grant_type_strategy.rb +22 -0
  32. data/lib/devise/oauth2_providable/version.rb +5 -0
  33. data/lib/devise_oauth2_providable.rb +41 -0
  34. data/script/rails +6 -0
  35. data/spec/controllers/authorizations_controller_spec.rb +32 -0
  36. data/spec/controllers/protected_controller_spec.rb +42 -0
  37. data/spec/dummy/Rakefile +7 -0
  38. data/spec/dummy/app/assets/javascripts/application.js +7 -0
  39. data/spec/dummy/app/assets/stylesheets/application.css +7 -0
  40. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  41. data/spec/dummy/app/controllers/protected_controller.rb +6 -0
  42. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  43. data/spec/dummy/app/mailers/.gitkeep +0 -0
  44. data/spec/dummy/app/models/.gitkeep +0 -0
  45. data/spec/dummy/app/models/user.rb +15 -0
  46. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  47. data/spec/dummy/config.ru +4 -0
  48. data/spec/dummy/config/application.rb +50 -0
  49. data/spec/dummy/config/boot.rb +10 -0
  50. data/spec/dummy/config/database.yml +25 -0
  51. data/spec/dummy/config/environment.rb +5 -0
  52. data/spec/dummy/config/environments/development.rb +30 -0
  53. data/spec/dummy/config/environments/production.rb +60 -0
  54. data/spec/dummy/config/environments/test.rb +39 -0
  55. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  56. data/spec/dummy/config/initializers/devise.rb +216 -0
  57. data/spec/dummy/config/initializers/inflections.rb +10 -0
  58. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  59. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  60. data/spec/dummy/config/initializers/session_store.rb +8 -0
  61. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  62. data/spec/dummy/config/locales/devise.en.yml +57 -0
  63. data/spec/dummy/config/locales/en.yml +5 -0
  64. data/spec/dummy/config/routes.rb +7 -0
  65. data/spec/dummy/db/migrate/20120521101005_create_users.rb +5 -0
  66. data/spec/dummy/db/migrate/20120521101006_add_devise_to_users.rb +53 -0
  67. data/spec/dummy/db/migrate/20120521101407_create_devise_oauth2_providable_schema.devise_oauth2_providable.rb +56 -0
  68. data/spec/dummy/db/schema.rb +88 -0
  69. data/spec/dummy/lib/assets/.gitkeep +0 -0
  70. data/spec/dummy/public/404.html +26 -0
  71. data/spec/dummy/public/422.html +26 -0
  72. data/spec/dummy/public/500.html +26 -0
  73. data/spec/dummy/public/favicon.ico +0 -0
  74. data/spec/dummy/script/rails +6 -0
  75. data/spec/factories.rb +19 -0
  76. data/spec/integration/oauth2_authorization_token_grant_type_strategy_spec.rb +136 -0
  77. data/spec/integration/oauth2_password_grant_type_strategy_spec.rb +198 -0
  78. data/spec/integration/oauth2_refresh_token_grant_type_strategy_spec.rb +138 -0
  79. data/spec/lib/devise_oauth2_providable_spec.rb +7 -0
  80. data/spec/models/access_token_spec.rb +51 -0
  81. data/spec/models/authorization_code_spec.rb +21 -0
  82. data/spec/models/client_spec.rb +22 -0
  83. data/spec/models/refresh_token_spec.rb +23 -0
  84. data/spec/models/user_spec.rb +6 -0
  85. data/spec/routing/authorizations_routing_spec.rb +17 -0
  86. data/spec/routing/tokens_routing_spec.rb +11 -0
  87. data/spec/spec_helper.rb +28 -0
  88. data/spec/support/match_json.rb +6 -0
  89. metadata +334 -0
@@ -0,0 +1,10 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format
4
+ # (all these examples are active by default):
5
+ # ActiveSupport::Inflector.inflections do |inflect|
6
+ # inflect.plural /^(ox)$/i, '\1en'
7
+ # inflect.singular /^(ox)en/i, '\1'
8
+ # inflect.irregular 'person', 'people'
9
+ # inflect.uncountable %w( fish sheep )
10
+ # end
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ Dummy::Application.config.secret_token = 'ede0a0440c0b53d6589668e54cf525f27305242a2b32b5dbbfc9e50dd7cb7af8da2b7d7c386b7d675283c0ecc4bb522ab4cc5b53edee8ed60f7482d4c22d0e22'
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Dummy::Application.config.session_store :cookie_store, :key => '_dummy_session'
4
+
5
+ # Use the database for sessions instead of the cookie-based default,
6
+ # which shouldn't be used to store highly confidential information
7
+ # (create the session table with "rails generate session_migration")
8
+ # Dummy::Application.config.session_store :active_record_store
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+ #
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters :format => [:json]
9
+ end
10
+
11
+ # Disable root element in JSON by default.
12
+ ActiveSupport.on_load(:active_record) do
13
+ self.include_root_in_json = false
14
+ end
@@ -0,0 +1,57 @@
1
+ # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2
+
3
+ en:
4
+ errors:
5
+ messages:
6
+ expired: "has expired, please request a new one"
7
+ not_found: "not found"
8
+ already_confirmed: "was already confirmed, please try signing in"
9
+ not_locked: "was not locked"
10
+ not_saved:
11
+ one: "1 error prohibited this %{resource} from being saved:"
12
+ other: "%{count} errors prohibited this %{resource} from being saved:"
13
+
14
+ devise:
15
+ failure:
16
+ already_authenticated: 'You are already signed in.'
17
+ unauthenticated: 'You need to sign in or sign up before continuing.'
18
+ unconfirmed: 'You have to confirm your account before continuing.'
19
+ locked: 'Your account is locked.'
20
+ invalid: 'Invalid email or password.'
21
+ invalid_token: 'Invalid authentication token.'
22
+ timeout: 'Your session expired, please sign in again to continue.'
23
+ inactive: 'Your account was not activated yet.'
24
+ sessions:
25
+ signed_in: 'Signed in successfully.'
26
+ signed_out: 'Signed out successfully.'
27
+ passwords:
28
+ send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.'
29
+ updated: 'Your password was changed successfully. You are now signed in.'
30
+ updated_not_active: 'Your password was changed successfully.'
31
+ send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
32
+ confirmations:
33
+ send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.'
34
+ send_paranoid_instructions: 'If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes.'
35
+ confirmed: 'Your account was successfully confirmed. You are now signed in.'
36
+ registrations:
37
+ signed_up: 'Welcome! You have signed up successfully.'
38
+ signed_up_but_unconfirmed: 'A message with a confirmation link has been sent to your email address. Please open the link to activate your account.'
39
+ signed_up_but_inactive: 'You have signed up successfully. However, we could not sign you in because your account is not yet activated.'
40
+ signed_up_but_locked: 'You have signed up successfully. However, we could not sign you in because your account is locked.'
41
+ updated: 'You updated your account successfully.'
42
+ update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address."
43
+ destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
44
+ unlocks:
45
+ send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'
46
+ unlocked: 'Your account has been unlocked successfully. Please sign in to continue.'
47
+ send_paranoid_instructions: 'If your account exists, you will receive an email with instructions about how to unlock it in a few minutes.'
48
+ omniauth_callbacks:
49
+ success: 'Successfully authenticated from %{kind} account.'
50
+ failure: 'Could not authenticate you from %{kind} because "%{reason}".'
51
+ mailer:
52
+ confirmation_instructions:
53
+ subject: 'Confirmation instructions'
54
+ reset_password_instructions:
55
+ subject: 'Reset password instructions'
56
+ unlock_instructions:
57
+ subject: 'Unlock Instructions'
@@ -0,0 +1,5 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ hello: "Hello world"
@@ -0,0 +1,7 @@
1
+ Rails.application.routes.draw do
2
+ devise_for :users
3
+
4
+ resources :protected
5
+
6
+ mount Devise::Oauth2Providable::Engine => '/oauth2'
7
+ end
@@ -0,0 +1,5 @@
1
+ class CreateUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table :users
4
+ end
5
+ end
@@ -0,0 +1,53 @@
1
+ class AddDeviseToUsers < ActiveRecord::Migration
2
+ def self.up
3
+ change_table(:users) do |t|
4
+ ## Database authenticatable
5
+ t.string :email, :null => false, :default => ""
6
+ t.string :encrypted_password, :null => false, :default => ""
7
+
8
+ ## Recoverable
9
+ t.string :reset_password_token
10
+ t.datetime :reset_password_sent_at
11
+
12
+ ## Rememberable
13
+ t.datetime :remember_created_at
14
+
15
+ ## Trackable
16
+ t.integer :sign_in_count, :default => 0
17
+ t.datetime :current_sign_in_at
18
+ t.datetime :last_sign_in_at
19
+ t.string :current_sign_in_ip
20
+ t.string :last_sign_in_ip
21
+
22
+ ## Confirmable
23
+ # t.string :confirmation_token
24
+ # t.datetime :confirmed_at
25
+ # t.datetime :confirmation_sent_at
26
+ # t.string :unconfirmed_email # Only if using reconfirmable
27
+
28
+ ## Lockable
29
+ # t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts
30
+ # t.string :unlock_token # Only if unlock strategy is :email or :both
31
+ # t.datetime :locked_at
32
+
33
+ ## Token authenticatable
34
+ # t.string :authentication_token
35
+
36
+
37
+ # Uncomment below if timestamps were not included in your original model.
38
+ # t.timestamps
39
+ end
40
+
41
+ add_index :users, :email, :unique => true
42
+ add_index :users, :reset_password_token, :unique => true
43
+ # add_index :users, :confirmation_token, :unique => true
44
+ # add_index :users, :unlock_token, :unique => true
45
+ # add_index :users, :authentication_token, :unique => true
46
+ end
47
+
48
+ def self.down
49
+ # By default, we don't want to make any assumption about how to roll back a migration when your
50
+ # model already existed. Please edit below which fields you would like to remove in this migration.
51
+ raise ActiveRecord::IrreversibleMigration
52
+ end
53
+ end
@@ -0,0 +1,56 @@
1
+ # This migration comes from devise_oauth2_providable (originally 20111014160714)
2
+ class CreateDeviseOauth2ProvidableSchema < ActiveRecord::Migration
3
+ def change
4
+ create_table :oauth2_clients do |t|
5
+ t.belongs_to :user
6
+ t.string :name
7
+ t.string :redirect_uri
8
+ t.string :website
9
+ t.string :identifier
10
+ t.string :secret
11
+ t.timestamps
12
+ end
13
+ change_table :oauth2_clients do |t|
14
+ t.index :identifier, :unique => true
15
+ end
16
+
17
+ create_table :oauth2_access_tokens do |t|
18
+ t.belongs_to :user, :client, :refresh_token
19
+ t.string :token
20
+ t.datetime :expires_at
21
+ t.timestamps
22
+ end
23
+ change_table :oauth2_access_tokens do |t|
24
+ t.index :token, :unique => true
25
+ t.index :expires_at
26
+ t.index :user_id
27
+ t.index :client_id
28
+ end
29
+
30
+ create_table :oauth2_refresh_tokens do |t|
31
+ t.belongs_to :user, :client
32
+ t.string :token
33
+ t.datetime :expires_at
34
+ t.timestamps
35
+ end
36
+ change_table :oauth2_refresh_tokens do |t|
37
+ t.index :token, :unique => true
38
+ t.index :expires_at
39
+ t.index :user_id
40
+ t.index :client_id
41
+ end
42
+
43
+ create_table :oauth2_authorization_codes do |t|
44
+ t.belongs_to :user, :client
45
+ t.string :token
46
+ t.datetime :expires_at
47
+ t.timestamps
48
+ end
49
+ change_table :oauth2_authorization_codes do |t|
50
+ t.index :token, :unique => true
51
+ t.index :expires_at
52
+ t.index :user_id
53
+ t.index :client_id
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,88 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended to check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(:version => 20120521101407) do
15
+
16
+ create_table "oauth2_access_tokens", :force => true do |t|
17
+ t.integer "user_id"
18
+ t.integer "client_id"
19
+ t.integer "refresh_token_id"
20
+ t.string "token"
21
+ t.datetime "expires_at"
22
+ t.datetime "created_at", :null => false
23
+ t.datetime "updated_at", :null => false
24
+ end
25
+
26
+ add_index "oauth2_access_tokens", ["client_id"], :name => "index_oauth2_access_tokens_on_client_id"
27
+ add_index "oauth2_access_tokens", ["expires_at"], :name => "index_oauth2_access_tokens_on_expires_at"
28
+ add_index "oauth2_access_tokens", ["token"], :name => "index_oauth2_access_tokens_on_token", :unique => true
29
+ add_index "oauth2_access_tokens", ["user_id"], :name => "index_oauth2_access_tokens_on_user_id"
30
+
31
+ create_table "oauth2_authorization_codes", :force => true do |t|
32
+ t.integer "user_id"
33
+ t.integer "client_id"
34
+ t.string "token"
35
+ t.datetime "expires_at"
36
+ t.datetime "created_at", :null => false
37
+ t.datetime "updated_at", :null => false
38
+ end
39
+
40
+ add_index "oauth2_authorization_codes", ["client_id"], :name => "index_oauth2_authorization_codes_on_client_id"
41
+ add_index "oauth2_authorization_codes", ["expires_at"], :name => "index_oauth2_authorization_codes_on_expires_at"
42
+ add_index "oauth2_authorization_codes", ["token"], :name => "index_oauth2_authorization_codes_on_token", :unique => true
43
+ add_index "oauth2_authorization_codes", ["user_id"], :name => "index_oauth2_authorization_codes_on_user_id"
44
+
45
+ create_table "oauth2_clients", :force => true do |t|
46
+ t.integer "user_id"
47
+ t.string "name"
48
+ t.string "redirect_uri"
49
+ t.string "website"
50
+ t.string "identifier"
51
+ t.string "secret"
52
+ t.datetime "created_at", :null => false
53
+ t.datetime "updated_at", :null => false
54
+ end
55
+
56
+ add_index "oauth2_clients", ["identifier"], :name => "index_oauth2_clients_on_identifier", :unique => true
57
+
58
+ create_table "oauth2_refresh_tokens", :force => true do |t|
59
+ t.integer "user_id"
60
+ t.integer "client_id"
61
+ t.string "token"
62
+ t.datetime "expires_at"
63
+ t.datetime "created_at", :null => false
64
+ t.datetime "updated_at", :null => false
65
+ end
66
+
67
+ add_index "oauth2_refresh_tokens", ["client_id"], :name => "index_oauth2_refresh_tokens_on_client_id"
68
+ add_index "oauth2_refresh_tokens", ["expires_at"], :name => "index_oauth2_refresh_tokens_on_expires_at"
69
+ add_index "oauth2_refresh_tokens", ["token"], :name => "index_oauth2_refresh_tokens_on_token", :unique => true
70
+ add_index "oauth2_refresh_tokens", ["user_id"], :name => "index_oauth2_refresh_tokens_on_user_id"
71
+
72
+ create_table "users", :force => true do |t|
73
+ t.string "email", :default => "", :null => false
74
+ t.string "encrypted_password", :default => "", :null => false
75
+ t.string "reset_password_token"
76
+ t.datetime "reset_password_sent_at"
77
+ t.datetime "remember_created_at"
78
+ t.integer "sign_in_count", :default => 0
79
+ t.datetime "current_sign_in_at"
80
+ t.datetime "last_sign_in_at"
81
+ t.string "current_sign_in_ip"
82
+ t.string "last_sign_in_ip"
83
+ end
84
+
85
+ add_index "users", ["email"], :name => "index_users_on_email", :unique => true
86
+ add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
87
+
88
+ end
File without changes
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ <p>We've been notified about this issue and we'll take a look at it shortly.</p>
24
+ </div>
25
+ </body>
26
+ </html>
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,19 @@
1
+ FactoryGirl.define do
2
+
3
+ sequence :email do |n|
4
+ "person#{n}@example.com"
5
+ end
6
+
7
+ factory :user do |f|
8
+ email
9
+ f.password 'test123456'
10
+ end
11
+
12
+ factory :client, :class => 'Devise::Oauth2Providable::Client' do |f|
13
+ f.name 'test'
14
+ f.website 'http://localhost'
15
+ f.redirect_uri 'http://localhost:3000'
16
+ user
17
+ end
18
+
19
+ end