dailycred 0.1.21 → 0.1.22

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. data/.gitignore +3 -0
  2. data/Rakefile +10 -0
  3. data/dailycred.gemspec +1 -1
  4. data/lib/dailycred.rb +14 -13
  5. data/lib/generators/dailycred_generator.rb +12 -1
  6. data/lib/generators/templates/login.html.erb +13 -0
  7. data/lib/generators/templates/migration_create_user.rb +5 -1
  8. data/lib/generators/templates/omniauth.rb +5 -1
  9. data/lib/generators/templates/sessions_controller.rb +5 -3
  10. data/lib/generators/templates/user.rb +8 -19
  11. data/lib/middleware/middleware.rb +18 -7
  12. data/lib/omniauth/strategies/dailycred.rb +26 -14
  13. data/lib/user/user.rb +63 -0
  14. data/localtest/.gitignore +15 -0
  15. data/localtest/Gemfile +39 -0
  16. data/localtest/README.rdoc +261 -0
  17. data/localtest/Rakefile +7 -0
  18. data/localtest/app/assets/images/rails.png +0 -0
  19. data/localtest/app/assets/javascripts/application.js +15 -0
  20. data/localtest/app/assets/stylesheets/application.css +13 -0
  21. data/localtest/app/controllers/application_controller.rb +42 -0
  22. data/localtest/app/controllers/sessions_controller.rb +27 -0
  23. data/localtest/app/helpers/application_helper.rb +2 -0
  24. data/localtest/app/mailers/.gitkeep +0 -0
  25. data/localtest/app/models/.gitkeep +0 -0
  26. data/localtest/app/models/user.rb +14 -0
  27. data/localtest/app/views/layouts/application.html.erb +14 -0
  28. data/localtest/app/views/sessions/info +9 -0
  29. data/localtest/config/application.rb +62 -0
  30. data/localtest/config/boot.rb +6 -0
  31. data/localtest/config/database.yml +25 -0
  32. data/localtest/config/environment.rb +5 -0
  33. data/localtest/config/environments/development.rb +37 -0
  34. data/localtest/config/environments/production.rb +67 -0
  35. data/localtest/config/environments/test.rb +37 -0
  36. data/localtest/config/initializers/backtrace_silencers.rb +7 -0
  37. data/localtest/config/initializers/inflections.rb +15 -0
  38. data/localtest/config/initializers/mime_types.rb +5 -0
  39. data/localtest/config/initializers/omniauth.rb +20 -0
  40. data/localtest/config/initializers/secret_token.rb +7 -0
  41. data/localtest/config/initializers/session_store.rb +8 -0
  42. data/localtest/config/initializers/wrap_parameters.rb +14 -0
  43. data/localtest/config/locales/en.yml +5 -0
  44. data/localtest/config/routes.rb +61 -0
  45. data/localtest/config.ru +4 -0
  46. data/localtest/db/migrate/20120906153457_create_users.rb +21 -0
  47. data/localtest/db/migrate/20120906234358_alter_column_from_users.rb +6 -0
  48. data/localtest/db/migrate/20120907004912_add_column_to_users.rb +5 -0
  49. data/localtest/db/migrate/20120907014514_add_tags_to_users.rb +6 -0
  50. data/localtest/db/schema.rb +33 -0
  51. data/localtest/db/seeds.rb +7 -0
  52. data/localtest/lib/assets/.gitkeep +0 -0
  53. data/localtest/lib/tasks/.gitkeep +0 -0
  54. data/localtest/log/.gitkeep +0 -0
  55. data/localtest/public/404.html +26 -0
  56. data/localtest/public/422.html +26 -0
  57. data/localtest/public/500.html +25 -0
  58. data/localtest/public/favicon.ico +0 -0
  59. data/localtest/public/robots.txt +5 -0
  60. data/localtest/script/rails +6 -0
  61. data/localtest/test/fixtures/.gitkeep +0 -0
  62. data/localtest/test/functional/.gitkeep +0 -0
  63. data/localtest/test/integration/.gitkeep +0 -0
  64. data/localtest/test/performance/browsing_test.rb +12 -0
  65. data/localtest/test/test_helper.rb +13 -0
  66. data/localtest/test/unit/.gitkeep +0 -0
  67. data/localtest/vendor/assets/javascripts/.gitkeep +0 -0
  68. data/localtest/vendor/assets/stylesheets/.gitkeep +0 -0
  69. data/localtest/vendor/plugins/.gitkeep +0 -0
  70. data/spec/{spec_helper.rb → helper_spec.rb} +2 -0
  71. data/spec/omniauth/strategies/dailycred_spec.rb +50 -10
  72. data/spec/support/dailycred_spec.rb +58 -0
  73. data/spec/support/shared_examples.rb +40 -0
  74. metadata +66 -4
@@ -0,0 +1,15 @@
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
11
+ #
12
+ # These inflection rules are supported but not enabled by default:
13
+ # ActiveSupport::Inflector.inflections do |inflect|
14
+ # inflect.acronym 'RESTful'
15
+ # 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,20 @@
1
+ Rails.configuration.DAILYCRED_CLIENT_ID = "a9dbdd59-585b-4f60-81b9-e1ee6d333ec9"
2
+ Rails.configuration.DAILYCRED_SECRET_KEY = "08d7800d-2d7c-4338-87de-4eed77d1c9b2-9f367fe8-4e39-4edc-a8c7-1e759f657185"
3
+
4
+ dc_id = Rails.configuration.DAILYCRED_CLIENT_ID
5
+ dc_secret = Rails.configuration.DAILYCRED_SECRET_KEY
6
+
7
+ dc_options = { :client_options => {:site => "http://localhost:9000"} }
8
+
9
+ if File.exists?('/etc/ssl/certs')
10
+ dc_options[:client_options][:ssl] = { :ca_path => '/etc/ssl/certs'}
11
+ end
12
+ if File.exists?('/opt/local/share/curl/curl-ca-bundle.crt')
13
+ dc_options[:client_options][:ssl] = { :ca_file => '/opt/local/share/curl/curl-ca-bundle.crt' }
14
+ end
15
+
16
+ Rails.application.config.middleware.use OmniAuth::Builder do
17
+ provider :dailycred, dc_id, dc_secret, dc_options
18
+ end
19
+
20
+ Rails.application.config.middleware.use "Dailycred::Middleware", dc_id, :url => "http://localhost:9000"
@@ -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
+ Localtest::Application.config.secret_token = 'b47ec21b5e8c6d0da7f7a4aaf6c37d11658fe996ea6ef61ea73fb6b7d085920eb296311f6c33b9eb2c67979cd7690b56ce0129e14f8e6b7d77ee3ccc2b1a7eaf'
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Localtest::Application.config.session_store :cookie_store, key: '_localtest_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
+ # Localtest::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,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,61 @@
1
+ Localtest::Application.routes.draw do
2
+ match '/auth/:provider/callback' => 'sessions#create'
3
+ match "/logout" => "sessions#destroy", :as => :logout
4
+ match "/auth" => "sessions#info", :as => :auth
5
+ # The priority is based upon order of creation:
6
+ # first created -> highest priority.
7
+
8
+ # Sample of regular route:
9
+ # match 'products/:id' => 'catalog#view'
10
+ # Keep in mind you can assign values other than :controller and :action
11
+
12
+ # Sample of named route:
13
+ # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
14
+ # This route can be invoked with purchase_url(:id => product.id)
15
+
16
+ # Sample resource route (maps HTTP verbs to controller actions automatically):
17
+ # resources :products
18
+
19
+ # Sample resource route with options:
20
+ # resources :products do
21
+ # member do
22
+ # get 'short'
23
+ # post 'toggle'
24
+ # end
25
+ #
26
+ # collection do
27
+ # get 'sold'
28
+ # end
29
+ # end
30
+
31
+ # Sample resource route with sub-resources:
32
+ # resources :products do
33
+ # resources :comments, :sales
34
+ # resource :seller
35
+ # end
36
+
37
+ # Sample resource route with more complex sub-resources
38
+ # resources :products do
39
+ # resources :comments
40
+ # resources :sales do
41
+ # get 'recent', :on => :collection
42
+ # end
43
+ # end
44
+
45
+ # Sample resource route within a namespace:
46
+ # namespace :admin do
47
+ # # Directs /admin/products/* to Admin::ProductsController
48
+ # # (app/controllers/admin/products_controller.rb)
49
+ # resources :products
50
+ # end
51
+
52
+ # You can have the root of your site routed with "root"
53
+ # just remember to delete public/index.html.
54
+ root :to => 'sessions#info'
55
+
56
+ # See how all your routes lay out with "rake routes"
57
+
58
+ # This is a legacy wild controller route that's not recommended for RESTful applications.
59
+ # Note: This route will make all actions in every controller accessible via GET requests.
60
+ # match ':controller(/:action(/:id))(.:format)'
61
+ end
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Localtest::Application
@@ -0,0 +1,21 @@
1
+ class CreateUsers < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :users do |t|
4
+ t.string :provider, null: false
5
+ t.string :uid, null: false
6
+ t.string :email, null: false, uniq: true
7
+ t.integer :created, :limit => 8
8
+ t.string :username
9
+ t.boolean :verified
10
+ t.boolean :admin
11
+ t.string :referred_by
12
+ t.string :token
13
+
14
+ t.timestamps
15
+ end
16
+ end
17
+
18
+ def self.down
19
+ drop_table :users
20
+ end
21
+ end
@@ -0,0 +1,6 @@
1
+ class AlterColumnFromUsers < ActiveRecord::Migration
2
+ def up
3
+ remove_column :users, :email
4
+ add_column :users, :email, :string
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ class AddColumnToUsers < ActiveRecord::Migration
2
+ def change
3
+ add_column :users, :facebook, :text
4
+ end
5
+ end
@@ -0,0 +1,6 @@
1
+ class AddTagsToUsers < ActiveRecord::Migration
2
+ def change
3
+ add_column :users, :tags, :text
4
+ add_column :users, :referred, :text
5
+ end
6
+ end
@@ -0,0 +1,33 @@
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 => 20120907014514) do
15
+
16
+ create_table "users", :force => true do |t|
17
+ t.string "provider", :null => false
18
+ t.string "uid", :null => false
19
+ t.integer "created", :limit => 8
20
+ t.string "username"
21
+ t.boolean "verified"
22
+ t.boolean "admin"
23
+ t.string "referred_by"
24
+ t.string "token"
25
+ t.datetime "created_at", :null => false
26
+ t.datetime "updated_at", :null => false
27
+ t.string "email"
28
+ t.text "facebook"
29
+ t.text "tags"
30
+ t.text "referred"
31
+ end
32
+
33
+ end
@@ -0,0 +1,7 @@
1
+ # This file should contain all the record creation needed to seed the database with its default values.
2
+ # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3
+ #
4
+ # Examples:
5
+ #
6
+ # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
7
+ # Mayor.create(name: 'Emanuel', city: cities.first)
File without changes
File without changes
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,25 @@
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
+ </div>
24
+ </body>
25
+ </html>
File without changes
@@ -0,0 +1,5 @@
1
+ # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
2
+ #
3
+ # To ban all spiders from the entire site uncomment the next two lines:
4
+ # User-Agent: *
5
+ # Disallow: /
@@ -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'
File without changes
File without changes
File without changes
@@ -0,0 +1,12 @@
1
+ require 'test_helper'
2
+ require 'rails/performance_test_help'
3
+
4
+ class BrowsingTest < ActionDispatch::PerformanceTest
5
+ # Refer to the documentation for all available options
6
+ # self.profile_options = { :runs => 5, :metrics => [:wall_time, :memory]
7
+ # :output => 'tmp/performance', :formats => [:flat] }
8
+
9
+ def test_homepage
10
+ get '/'
11
+ end
12
+ end
@@ -0,0 +1,13 @@
1
+ ENV["RAILS_ENV"] = "test"
2
+ require File.expand_path('../../config/environment', __FILE__)
3
+ require 'rails/test_help'
4
+
5
+ class ActiveSupport::TestCase
6
+ # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
7
+ #
8
+ # Note: You'll currently still have to declare fixtures explicitly in integration tests
9
+ # -- they do not yet inherit this setting
10
+ fixtures :all
11
+
12
+ # Add more helper methods to be used by all tests here...
13
+ end
File without changes
File without changes
File without changes
File without changes
@@ -9,6 +9,8 @@ require 'dailycred'
9
9
 
10
10
  Dir[File.expand_path('../support/**/*', __FILE__)].each { |f| require f }
11
11
 
12
+ # require 'omniauth/strategies/dailycred_spec'
13
+
12
14
  RSpec.configure do |config|
13
15
  config.include Rack::Test::Methods
14
16
  config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
@@ -1,22 +1,62 @@
1
- require 'spec_helper'
2
-
1
+ require 'helper_spec'
3
2
  describe OmniAuth::Strategies::Dailycred do
4
3
  subject do
5
4
  OmniAuth::Strategies::Dailycred.new(nil, @options || {})
6
5
  end
7
-
8
-
6
+
7
+ OmniAuth.config.test_mode = true
8
+ OmniAuth.config.add_mock(:dailycred, {:id => '12345',
9
+ :email => 'Test@test.com',
10
+ :username => 'test',
11
+ :created => 45678,
12
+ :verified => false,
13
+ :admin => true,
14
+ :referred_by => 'dave' })
15
+
16
+ it_should_behave_like 'an oauth2 strategy'
17
+
18
+
9
19
  describe '#client' do
10
- it 'should have the correct dwolla site' do
11
- subject.client.site.should eq("https://auth.dailycred.com")
20
+ it 'should have the correct dailycred site' do
21
+ subject.client.site.should eq("https://www.dailycred.com")
12
22
  end
13
23
  it 'should have the correct authorization url' do
14
- subject.client.options[:authorize_url].should eq("https://auth.dailycred.com/oauth/authorize")
24
+ subject.client.options[:authorize_url].should eq("/oauth/authorize")
15
25
  end
16
-
26
+
17
27
  it 'should have the correct token url' do
18
- subject.client.options[:token_url].should eq('https://auth.dailycred.com/oauth/tokeninfo')
28
+ subject.client.options[:token_url].should eq('/oauth/access_token')
19
29
  end
20
30
  end
21
-
31
+
32
+ # describe 'getting info' do
33
+ # before do
34
+ # @access_token = double("token" => 'test_token')
35
+ # @dailycred_user = double( :id => '12345',
36
+ # :email => 'test@test.com',
37
+ # :username => 'test',
38
+ # :id => 45678,
39
+ # :verified => false,
40
+ # :admin => true,
41
+ # :referred_by => 'dave' )
42
+
43
+ # subject.stub(:access_token) { @access_token }
44
+
45
+ # @dailycred_user.should_receive(:fetch).and_return(@dailycred_user)
46
+ # end
47
+
48
+ # it 'should set the correct info based on user' do
49
+ # subject.info.should == {:id => '12345',
50
+ # :email => 'test@test.com',
51
+ # :username => 'test',
52
+ # :created => 45678,
53
+ # :verified => false,
54
+ # :admin => true,
55
+ # :referred_by => 'dave' }
56
+ # end
57
+
58
+ # it 'set the correct uid based on user' do
59
+ # subject.id.should == '12345'
60
+ # end
61
+ # end
22
62
  end
@@ -0,0 +1,58 @@
1
+ require 'json'
2
+ require 'pp'
3
+ describe Dailycred do
4
+ subject do
5
+
6
+ end
7
+
8
+ before(:each) do
9
+ site = "https://www.dailycred.com"
10
+ client_id = "f1fd998c-bc48-4e1b-bc88-98f9373ba60f"
11
+ secret = "6925d89e-d04d-469e-8fc9-3782af57bc29-c2340f1e-25a0-40af-b638-7429947a6cd7"
12
+ @user_id = "0c19c355-2a71-4c8e-805e-f7a6087ea84c"
13
+
14
+ #dev settings
15
+ # site = "http://localhost:9000"
16
+ # client_id = "4337ed55-aaca-4e38-8824-6c016c59dd5b"
17
+ # secret = "34f2ecc3-f955-4292-9747-39b876d91d8b-a4f7ad8e-f8a4-4573-b23d-686f6e28a820"
18
+ # @user_id = "97a85558-c5a6-47de-ab89-4e7de02c99bd"
19
+
20
+ dc_options = { :client_options => {
21
+ :site => site,
22
+ :authorize_url => '/oauth/authorize',
23
+ :token_url => '/oauth/access_token'
24
+ } }
25
+
26
+ if File.exists?('/etc/ssl/certs')
27
+ dc_options[:client_options][:ssl] = { :ca_path => '/etc/ssl/certs'}
28
+ end
29
+
30
+ if File.exists?('/opt/local/share/curl/curl-ca-bundle.crt')
31
+ dc_options[:client_options][:ssl] = { :ca_file => '/opt/local/share/curl/curl-ca-bundle.crt' }
32
+ end
33
+
34
+ @dc = Dailycred.new client_id, secret, dc_options
35
+ end
36
+
37
+ it "tags a user" do
38
+ response = @dc.tag(@user_id, "loser")
39
+ json = JSON.parse response.body
40
+ json["worked"].should == true
41
+ user = json["user"]
42
+ # user["tags"].should include('loser') #will work in next push
43
+ end
44
+
45
+ it "untags a user" do
46
+ response = @dc.untag(@user_id, "loser")
47
+ json = JSON.parse response.body
48
+ json["worked"].should == true
49
+ user = json["user"]
50
+ # user["tags"].should == nil #will work in next push
51
+ end
52
+
53
+ it "fires an event" do
54
+ response = @dc.event(@user_id, "became a loser")
55
+ json = JSON.parse response.body
56
+ json["worked"].should == true
57
+ end
58
+ end
@@ -0,0 +1,40 @@
1
+ # NOTE it would be useful if this lived in omniauth-oauth2 eventually
2
+ # Thanks to Josh Ellithorpe for this file -Will
3
+
4
+ shared_examples 'an oauth2 strategy' do
5
+ describe '#client' do
6
+ it 'should be initialized with symbolized client_options' do
7
+ @options = { :client_options => { 'authorize_url' => 'https://example.com' } }
8
+ subject.client.options[:authorize_url].should == 'https://example.com'
9
+ end
10
+ end
11
+
12
+ describe '#authorize_params' do
13
+ # it 'should include any authorize params passed in the :authorize_params option' do
14
+ # @options = { :authorize_params => { :foo => 'bar', :baz => 'zip' } }
15
+ # p subject.authorize_params
16
+ # subject.authorize_params['foo'].should eq('bar')
17
+ # subject.authorize_params['baz'].should eq('zip')
18
+ # end
19
+
20
+ it 'should include top-level options that are marked as :authorize_options' do
21
+ @options = { :authorize_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' }
22
+ subject.authorize_params['scope'].should eq('bar')
23
+ subject.authorize_params['foo'].should eq('baz')
24
+ end
25
+ end
26
+
27
+ describe '#token_params' do
28
+ it 'should include any token params passed in the :token_params option' do
29
+ @options = { :token_params => { :foo => 'bar', :baz => 'zip' } }
30
+ subject.token_params['foo'].should eq('bar')
31
+ subject.token_params['baz'].should eq('zip')
32
+ end
33
+
34
+ it 'should include top-level options that are marked as :token_options' do
35
+ @options = { :token_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' }
36
+ subject.token_params['scope'].should eq('bar')
37
+ subject.token_params['foo'].should eq('baz')
38
+ end
39
+ end
40
+ end