[DRE-commits] [ruby-omniauth-oauth2] 01/03: Imported Upstream version 1.4.0

Sudheesh Shetty sudheeshshetty-guest at moszumanska.debian.org
Wed Mar 16 19:15:10 UTC 2016


This is an automated email from the git hooks/post-receive script.

sudheeshshetty-guest pushed a commit to branch master
in repository ruby-omniauth-oauth2.

commit 98673d7e7ca1bcb624d910ec192b4dc6d0c82bfa
Author: Sudheeshshetty <sudheeshshetty at gmail.com>
Date:   Wed Mar 16 23:46:29 2016 +0530

    Imported Upstream version 1.4.0
---
 .rubocop.yml                            |  84 ++++++++----------------------
 .travis.yml                             |  20 ++++----
 Gemfile                                 |  29 ++++-------
 Guardfile                               |  11 ----
 Rakefile                                |   8 +--
 checksums.yaml.gz                       | Bin 267 -> 0 bytes
 lib/omniauth-oauth2.rb                  |   4 +-
 lib/omniauth-oauth2/version.rb          |   2 +-
 lib/omniauth/strategies/oauth2.rb       |  58 ++++++++++-----------
 metadata.yml                            |  41 ++-------------
 omniauth-oauth2.gemspec                 |  22 ++++----
 spec/helper.rb                          |  30 +++++------
 spec/omniauth/strategies/oauth2_spec.rb |  87 ++++++++++++++++++--------------
 13 files changed, 153 insertions(+), 243 deletions(-)

diff --git a/.rubocop.yml b/.rubocop.yml
index 666aeb5..8dbbbf0 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -1,82 +1,42 @@
-AllCops:
-  Include:
-    - 'Gemfile'
-    - 'Rakefile'
-    - 'omniauth-oauth2.gemspec'
+Metrics/BlockNesting:
+  Max: 2
 
-# Avoid long parameter lists
-ParameterLists:
-  Max: 5
-  CountKeywordArgs: true
+Metrics/LineLength:
+  AllowURI: true
+  Enabled: false
 
-MethodLength:
+Metrics/MethodLength:
   CountComments: false
-  Max: 18
+  Max: 10
 
-# Avoid more than `Max` levels of nesting.
-BlockNesting:
-  Max: 2
+Metrics/ParameterLists:
+  Max: 4
+  CountKeywordArgs: true
 
-# Align with the style guide.
-CollectionMethods:
+Style/AccessModifierIndentation:
+  EnforcedStyle: outdent
+
+Style/CollectionMethods:
   PreferredMethods:
     map:      'collect'
     reduce:   'inject'
     find:     'detect'
     find_all: 'select'
 
-# Do not force public/protected/private keyword to be indented at the same
-# level as the def keyword. My personal preference is to outdent these keywords
-# because I think when scanning code it makes it easier to identify the
-# sections of code and visually separate them. When the keyword is at the same
-# level I think it sort of blends in with the def keywords and makes it harder
-# to scan the code and see where the sections are.
-AccessModifierIndentation:
+Style/Documentation:
   Enabled: false
 
-# Limit line length
-LineLength:
+Style/DoubleNegation:
   Enabled: false
 
-# Disable documentation checking until a class needs to be documented once
-Documentation:
-  Enabled: false
-
-# Enforce Ruby 1.8-compatible hash syntax
-HashSyntax:
+Style/HashSyntax:
   EnforcedStyle: hash_rockets
 
-# No spaces inside hash literals
-SpaceInsideHashLiteralBraces:
+Style/SpaceInsideHashLiteralBraces:
   EnforcedStyle: no_space
 
-# Allow dots at the end of lines
-DotPosition:
-  Enabled: false
-
-# Don't require magic comment at the top of every file
-Encoding:
-  Enabled: false
-
-# Enforce outdenting of access modifiers (i.e. public, private, protected)
-AccessModifierIndentation:
-  EnforcedStyle: outdent
-
-EmptyLinesAroundAccessModifier:
-  Enabled: true
-
-# Align ends correctly
-EndAlignment:
-  AlignWith: variable
-
-# Indentation of when/else
-CaseIndentation:
-  IndentWhenRelativeTo: end
-  IndentOneStep: false
-
-Lambda:
-  Enabled: false
+Style/StringLiterals:
+  EnforcedStyle: double_quotes
 
-FileName:
-  Exclude:
-    - 'lib/omniauth-oauth2.rb'
+Style/TrailingComma:
+  EnforcedStyleForMultiline: 'comma'
diff --git a/.travis.yml b/.travis.yml
index de47ae3..d2e47a0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,22 +1,22 @@
-bundler_args: --without development
+before_install: gem install bundler
+env:
+  global:
+    - JRUBY_OPTS="$JRUBY_OPTS --debug"
 language: ruby
 rvm:
   - 1.8.7
-  - 1.9.2
   - 1.9.3
   - 2.0.0
-  - 2.1.0
+  - 2.1
+  - 2.2
+  - jruby-18mode
+  - jruby-19mode
+  - jruby-head
   - rbx-2
   - ruby-head
 matrix:
-  include:
-    - rvm: jruby-18mode
-      env: JRUBY_OPTS="$JRUBY_OPTS --debug"
-    - rvm: jruby-19mode
-      env: JRUBY_OPTS="$JRUBY_OPTS --debug"
-    - rvm: jruby-head
-      env: JRUBY_OPTS="$JRUBY_OPTS --debug"
   allow_failures:
     - rvm: jruby-head
     - rvm: ruby-head
   fast_finish: true
+sudo: false
diff --git a/Gemfile b/Gemfile
index 7275aef..8b100f4 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,24 +1,17 @@
-source 'http://rubygems.org'
+source "http://rubygems.org"
 
-gem 'rake'
-
-group :development do
-  platforms :ruby_19, :ruby_20, :ruby_21 do
-    gem 'guard'
-    gem 'guard-rspec'
-    gem 'guard-bundler'
-  end
-end
+gem "rake"
 
 group :test do
-  gem 'coveralls', :require => false
-  gem 'json', :platforms => [:jruby, :ruby_18, :ruby_19]
-  gem 'mime-types', '~> 1.25', :platforms => [:jruby, :ruby_18]
-  gem 'rack-test'
-  gem 'rspec', '~> 3.0.0'
-  gem 'rubocop', '>= 0.21', :platforms => [:ruby_19, :ruby_20, :ruby_21]
-  gem 'simplecov', :require => false
-  gem 'webmock'
+  gem "coveralls"
+  gem "json", :platforms => [:jruby, :ruby_18, :ruby_19]
+  gem "mime-types", "~> 1.25", :platforms => [:jruby, :ruby_18]
+  gem "rack-test"
+  gem "rest-client", "~> 1.6.0", :platforms => [:jruby, :ruby_18]
+  gem "rspec", "~> 3.2"
+  gem "rubocop", ">= 0.30", :platforms => [:ruby_19, :ruby_20, :ruby_21, :ruby_22]
+  gem "simplecov", ">= 0.9"
+  gem "webmock"
 end
 
 # Specify your gem's dependencies in omniauth-oauth2.gemspec
diff --git a/Guardfile b/Guardfile
deleted file mode 100644
index df36f0d..0000000
--- a/Guardfile
+++ /dev/null
@@ -1,11 +0,0 @@
-guard 'rspec', :version => 2 do
-  watch(%r{^spec/.+_spec\.rb$})
-  watch(%r{^lib/(.+)\.rb$})     { |m| "spec/#{m[1]}_spec.rb" }
-  watch('spec/spec_helper.rb')  { "spec" }
-end
-
-
-guard 'bundler' do
-  watch('Gemfile')
-  watch(/^.+\.gemspec/)
-end
diff --git a/Rakefile b/Rakefile
index 8811322..3dacd1f 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,17 +1,17 @@
 #!/usr/bin/env rake
-require 'bundler/gem_tasks'
-require 'rspec/core/rake_task'
+require "bundler/gem_tasks"
+require "rspec/core/rake_task"
 
 RSpec::Core::RakeTask.new
 
 task :test => :spec
 
 begin
-  require 'rubocop/rake_task'
+  require "rubocop/rake_task"
   RuboCop::RakeTask.new
 rescue LoadError
   task :rubocop do
-    $stderr.puts 'RuboCop is disabled'
+    $stderr.puts "RuboCop is disabled"
   end
 end
 
diff --git a/checksums.yaml.gz b/checksums.yaml.gz
deleted file mode 100644
index 8401271..0000000
Binary files a/checksums.yaml.gz and /dev/null differ
diff --git a/lib/omniauth-oauth2.rb b/lib/omniauth-oauth2.rb
index cc618e0..894d81c 100644
--- a/lib/omniauth-oauth2.rb
+++ b/lib/omniauth-oauth2.rb
@@ -1,2 +1,2 @@
-require 'omniauth-oauth2/version'
-require 'omniauth/strategies/oauth2'
+require "omniauth-oauth2/version" # rubocop:disable FileName
+require "omniauth/strategies/oauth2"
diff --git a/lib/omniauth-oauth2/version.rb b/lib/omniauth-oauth2/version.rb
index 6bd7812..5a79a34 100644
--- a/lib/omniauth-oauth2/version.rb
+++ b/lib/omniauth-oauth2/version.rb
@@ -1,5 +1,5 @@
 module OmniAuth
   module OAuth2
-    VERSION = '1.2.0'
+    VERSION = "1.4.0"
   end
 end
diff --git a/lib/omniauth/strategies/oauth2.rb b/lib/omniauth/strategies/oauth2.rb
index fcb5b45..3ffff1b 100644
--- a/lib/omniauth/strategies/oauth2.rb
+++ b/lib/omniauth/strategies/oauth2.rb
@@ -1,10 +1,8 @@
-require 'oauth2'
-require 'omniauth'
-require 'securerandom'
-require 'socket'       # for SocketError
-require 'timeout'      # for Timeout::Error
-require 'faraday'      # for Faraday::Error::TimeoutError and Faraday::Error::ConnectionFailed
-require 'multi_json'   # for MultiJson::DecodeError
+require "oauth2"
+require "omniauth"
+require "securerandom"
+require "socket"       # for SocketError
+require "timeout"      # for Timeout::Error
 
 module OmniAuth
   module Strategies
@@ -16,6 +14,10 @@ module OmniAuth
     class OAuth2
       include OmniAuth::Strategy
 
+      def self.inherited(subclass)
+        OmniAuth::Strategy.included(subclass)
+      end
+
       args [:client_id, :client_secret]
 
       option :client_id, nil
@@ -34,15 +36,11 @@ module OmniAuth
         ::OAuth2::Client.new(options.client_id, options.client_secret, deep_symbolize(options.client_options))
       end
 
-      def callback_url
-        full_host + script_name + callback_path
-      end
-
       credentials do
-        hash = {'token' => access_token.token}
-        hash.merge!('refresh_token' => access_token.refresh_token) if access_token.expires? && access_token.refresh_token
-        hash.merge!('expires_at' => access_token.expires_at) if access_token.expires?
-        hash.merge!('expires' => access_token.expires?)
+        hash = {"token" => access_token.token}
+        hash.merge!("refresh_token" => access_token.refresh_token) if access_token.expires? && access_token.refresh_token
+        hash.merge!("expires_at" => access_token.expires_at) if access_token.expires?
+        hash.merge!("expires" => access_token.expires?)
         hash
       end
 
@@ -52,25 +50,25 @@ module OmniAuth
 
       def authorize_params
         options.authorize_params[:state] = SecureRandom.hex(24)
-        params = options.authorize_params.merge(options_for('authorize'))
+        params = options.authorize_params.merge(options_for("authorize"))
         if OmniAuth.config.test_mode
           @env ||= {}
-          @env['rack.session'] ||= {}
+          @env["rack.session"] ||= {}
         end
-        session['omniauth.state'] = params[:state]
+        session["omniauth.state"] = params[:state]
         params
       end
 
       def token_params
-        options.token_params.merge(options_for('token'))
+        options.token_params.merge(options_for("token"))
       end
 
-      def callback_phase # rubocop:disable CyclomaticComplexity
-        error = request.params['error_reason'] || request.params['error']
+      def callback_phase # rubocop:disable AbcSize, CyclomaticComplexity, MethodLength, PerceivedComplexity
+        error = request.params["error_reason"] || request.params["error"]
         if error
-          fail!(error, CallbackError.new(request.params['error'], request.params['error_description'] || request.params['error_reason'], request.params['error_uri']))
-        elsif !options.provider_ignores_state && (request.params['state'].to_s.empty? || request.params['state'] != session.delete('omniauth.state'))
-          fail!(:csrf_detected, CallbackError.new(:csrf_detected, 'CSRF detected'))
+          fail!(error, CallbackError.new(request.params["error"], request.params["error_description"] || request.params["error_reason"], request.params["error_uri"]))
+        elsif !options.provider_ignores_state && (request.params["state"].to_s.empty? || request.params["state"] != session.delete("omniauth.state"))
+          fail!(:csrf_detected, CallbackError.new(:csrf_detected, "CSRF detected"))
         else
           self.access_token = build_access_token
           self.access_token = access_token.refresh! if access_token.expired?
@@ -78,18 +76,16 @@ module OmniAuth
         end
       rescue ::OAuth2::Error, CallbackError => e
         fail!(:invalid_credentials, e)
-      rescue ::MultiJson::DecodeError => e
-        fail!(:invalid_response, e)
-      rescue ::Timeout::Error, ::Errno::ETIMEDOUT, Faraday::Error::TimeoutError => e
+      rescue ::Timeout::Error, ::Errno::ETIMEDOUT => e
         fail!(:timeout, e)
-      rescue ::SocketError, Faraday::Error::ConnectionFailed => e
+      rescue ::SocketError => e
         fail!(:failed_to_connect, e)
       end
 
     protected
 
       def build_access_token
-        verifier = request.params['code']
+        verifier = request.params["code"]
         client.auth_code.get_token(verifier, {:redirect_uri => callback_url}.merge(token_params.to_hash(:symbolize_keys => true)), deep_symbolize(options.auth_token_params))
       end
 
@@ -121,11 +117,11 @@ module OmniAuth
         end
 
         def message
-          [error, error_reason, error_uri].compact.join(' | ')
+          [error, error_reason, error_uri].compact.join(" | ")
         end
       end
     end
   end
 end
 
-OmniAuth.config.add_camelization 'oauth2', 'OAuth2'
+OmniAuth.config.add_camelization "oauth2", "OAuth2"
diff --git a/metadata.yml b/metadata.yml
index b6d2ac1..84dbccf 100644
--- a/metadata.yml
+++ b/metadata.yml
@@ -1,7 +1,7 @@
 --- !ruby/object:Gem::Specification
 name: omniauth-oauth2
 version: !ruby/object:Gem::Version
-  version: 1.2.0
+  version: 1.4.0
 platform: ruby
 authors:
 - Michael Bleigh
@@ -9,43 +9,9 @@ authors:
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2014-07-09 00:00:00.000000000 Z
+date: 2015-10-21 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
-  name: faraday
-  requirement: !ruby/object:Gem::Requirement
-    requirements:
-    - - ">="
-      - !ruby/object:Gem::Version
-        version: '0.8'
-    - - "<"
-      - !ruby/object:Gem::Version
-        version: '0.10'
-  type: :runtime
-  prerelease: false
-  version_requirements: !ruby/object:Gem::Requirement
-    requirements:
-    - - ">="
-      - !ruby/object:Gem::Version
-        version: '0.8'
-    - - "<"
-      - !ruby/object:Gem::Version
-        version: '0.10'
-- !ruby/object:Gem::Dependency
-  name: multi_json
-  requirement: !ruby/object:Gem::Requirement
-    requirements:
-    - - "~>"
-      - !ruby/object:Gem::Version
-        version: '1.3'
-  type: :runtime
-  prerelease: false
-  version_requirements: !ruby/object:Gem::Requirement
-    requirements:
-    - - "~>"
-      - !ruby/object:Gem::Version
-        version: '1.3'
-- !ruby/object:Gem::Dependency
   name: oauth2
   requirement: !ruby/object:Gem::Requirement
     requirements:
@@ -100,7 +66,6 @@ files:
 - ".rubocop.yml"
 - ".travis.yml"
 - Gemfile
-- Guardfile
 - LICENSE.md
 - README.md
 - Rakefile
@@ -130,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
       version: '0'
 requirements: []
 rubyforge_project: 
-rubygems_version: 2.2.2
+rubygems_version: 2.4.8
 signing_key: 
 specification_version: 4
 summary: An abstract OAuth2 strategy for OmniAuth.
diff --git a/omniauth-oauth2.gemspec b/omniauth-oauth2.gemspec
index 79132f9..53983a4 100644
--- a/omniauth-oauth2.gemspec
+++ b/omniauth-oauth2.gemspec
@@ -1,26 +1,24 @@
-lib = File.expand_path('../lib', __FILE__)
+lib = File.expand_path("../lib", __FILE__)
 $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
-require 'omniauth-oauth2/version'
+require "omniauth-oauth2/version"
 
 Gem::Specification.new do |gem|
-  gem.add_dependency 'faraday',   ['>= 0.8', '< 0.10']
-  gem.add_dependency 'multi_json', '~> 1.3'
-  gem.add_dependency 'oauth2',     '~> 1.0'
-  gem.add_dependency 'omniauth',   '~> 1.2'
+  gem.add_dependency "oauth2",     "~> 1.0"
+  gem.add_dependency "omniauth",   "~> 1.2"
 
-  gem.add_development_dependency 'bundler', '~> 1.0'
+  gem.add_development_dependency "bundler", "~> 1.0"
 
-  gem.authors       = ['Michael Bleigh', 'Erik Michaels-Ober']
-  gem.email         = ['michael at intridea.com', 'sferik at gmail.com']
-  gem.description   = %q(An abstract OAuth2 strategy for OmniAuth.)
+  gem.authors       = ["Michael Bleigh", "Erik Michaels-Ober"]
+  gem.email         = ["michael at intridea.com", "sferik at gmail.com"]
+  gem.description   = "An abstract OAuth2 strategy for OmniAuth."
   gem.summary       = gem.description
-  gem.homepage      = 'https://github.com/intridea/omniauth-oauth2'
+  gem.homepage      = "https://github.com/intridea/omniauth-oauth2"
   gem.licenses      = %w(MIT)
 
   gem.executables   = `git ls-files -- bin/*`.split("\n").collect { |f| File.basename(f) }
   gem.files         = `git ls-files`.split("\n")
   gem.test_files    = `git ls-files -- {test,spec,features}/*`.split("\n")
-  gem.name          = 'omniauth-oauth2'
+  gem.name          = "omniauth-oauth2"
   gem.require_paths = %w(lib)
   gem.version       = OmniAuth::OAuth2::VERSION
 end
diff --git a/spec/helper.rb b/spec/helper.rb
index dc6d0c3..280be5f 100644
--- a/spec/helper.rb
+++ b/spec/helper.rb
@@ -1,22 +1,22 @@
-$LOAD_PATH.unshift File.expand_path('..', __FILE__)
-$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
+$LOAD_PATH.unshift File.expand_path("..", __FILE__)
+$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
 
-require 'simplecov'
-require 'coveralls'
+if RUBY_VERSION >= "1.9"
+  require "simplecov"
+  require "coveralls"
 
-SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
-  SimpleCov::Formatter::HTMLFormatter,
-  Coveralls::SimpleCov::Formatter
-]
-SimpleCov.start do
-  minimum_coverage(76)
+  SimpleCov.formatters = [SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter]
+
+  SimpleCov.start do
+    minimum_coverage(78.48)
+  end
 end
 
-require 'rspec'
-require 'rack/test'
-require 'webmock/rspec'
-require 'omniauth'
-require 'omniauth-oauth2'
+require "rspec"
+require "rack/test"
+require "webmock/rspec"
+require "omniauth"
+require "omniauth-oauth2"
 
 RSpec.configure do |config|
   config.expect_with :rspec do |c|
diff --git a/spec/omniauth/strategies/oauth2_spec.rb b/spec/omniauth/strategies/oauth2_spec.rb
index c39e542..0bffcde 100644
--- a/spec/omniauth/strategies/oauth2_spec.rb
+++ b/spec/omniauth/strategies/oauth2_spec.rb
@@ -1,9 +1,9 @@
-require 'helper'
+require "helper"
 
 describe OmniAuth::Strategies::OAuth2 do
   def app
     lambda do |_env|
-      [200, {}, ['Hello.']]
+      [200, {}, ["Hello."]]
     end
   end
   let(:fresh_strategy) { Class.new(OmniAuth::Strategies::OAuth2) }
@@ -16,65 +16,74 @@ describe OmniAuth::Strategies::OAuth2 do
     OmniAuth.config.test_mode = false
   end
 
-  describe '#client' do
+  describe "Subclassing Behavior" do
     subject { fresh_strategy }
 
-    it 'is initialized with symbolized client_options' do
-      instance = subject.new(app, :client_options => {'authorize_url' => 'https://example.com'})
-      expect(instance.client.options[:authorize_url]).to eq('https://example.com')
+    it "performs the OmniAuth::Strategy included hook" do
+      expect(OmniAuth.strategies).to include(OmniAuth::Strategies::OAuth2)
+      expect(OmniAuth.strategies).to include(subject)
+    end
+  end
+
+  describe "#client" do
+    subject { fresh_strategy }
+
+    it "is initialized with symbolized client_options" do
+      instance = subject.new(app, :client_options => {"authorize_url" => "https://example.com"})
+      expect(instance.client.options[:authorize_url]).to eq("https://example.com")
     end
 
-    it 'sets ssl options as connection options' do
-      instance = subject.new(app, :client_options => {'ssl' => {'ca_path' => 'foo'}})
-      expect(instance.client.options[:connection_opts][:ssl]).to eq(:ca_path => 'foo')
+    it "sets ssl options as connection options" do
+      instance = subject.new(app, :client_options => {"ssl" => {"ca_path" => "foo"}})
+      expect(instance.client.options[:connection_opts][:ssl]).to eq(:ca_path => "foo")
     end
   end
 
-  describe '#authorize_params' do
+  describe "#authorize_params" do
     subject { fresh_strategy }
 
-    it 'includes any authorize params passed in the :authorize_params option' do
-      instance = subject.new('abc', 'def', :authorize_params => {:foo => 'bar', :baz => 'zip'})
-      expect(instance.authorize_params['foo']).to eq('bar')
-      expect(instance.authorize_params['baz']).to eq('zip')
+    it "includes any authorize params passed in the :authorize_params option" do
+      instance = subject.new("abc", "def", :authorize_params => {:foo => "bar", :baz => "zip"})
+      expect(instance.authorize_params["foo"]).to eq("bar")
+      expect(instance.authorize_params["baz"]).to eq("zip")
     end
 
-    it 'includes top-level options that are marked as :authorize_options' do
-      instance = subject.new('abc', 'def', :authorize_options => [:scope, :foo, :state], :scope => 'bar', :foo => 'baz')
-      expect(instance.authorize_params['scope']).to eq('bar')
-      expect(instance.authorize_params['foo']).to eq('baz')
+    it "includes top-level options that are marked as :authorize_options" do
+      instance = subject.new("abc", "def", :authorize_options => [:scope, :foo, :state], :scope => "bar", :foo => "baz")
+      expect(instance.authorize_params["scope"]).to eq("bar")
+      expect(instance.authorize_params["foo"]).to eq("baz")
     end
 
-    it 'includes random state in the authorize params' do
-      instance = subject.new('abc', 'def')
-      expect(instance.authorize_params.keys).to eq(['state'])
-      expect(instance.session['omniauth.state']).not_to be_empty
+    it "includes random state in the authorize params" do
+      instance = subject.new("abc", "def")
+      expect(instance.authorize_params.keys).to eq(["state"])
+      expect(instance.session["omniauth.state"]).not_to be_empty
     end
   end
 
-  describe '#token_params' do
+  describe "#token_params" do
     subject { fresh_strategy }
 
-    it 'includes any authorize params passed in the :authorize_params option' do
-      instance = subject.new('abc', 'def', :token_params => {:foo => 'bar', :baz => 'zip'})
-      expect(instance.token_params).to eq('foo' => 'bar', 'baz' => 'zip')
+    it "includes any authorize params passed in the :authorize_params option" do
+      instance = subject.new("abc", "def", :token_params => {:foo => "bar", :baz => "zip"})
+      expect(instance.token_params).to eq("foo" => "bar", "baz" => "zip")
     end
 
-    it 'includes top-level options that are marked as :authorize_options' do
-      instance = subject.new('abc', 'def', :token_options => [:scope, :foo], :scope => 'bar', :foo => 'baz')
-      expect(instance.token_params).to eq('scope' => 'bar', 'foo' => 'baz')
+    it "includes top-level options that are marked as :authorize_options" do
+      instance = subject.new("abc", "def", :token_options => [:scope, :foo], :scope => "bar", :foo => "baz")
+      expect(instance.token_params).to eq("scope" => "bar", "foo" => "baz")
     end
   end
 
-  describe '#callback_phase' do
+  describe "#callback_phase" do
     subject { fresh_strategy }
-    it 'calls fail with the client error received' do
-      instance = subject.new('abc', 'def')
+    it "calls fail with the client error received" do
+      instance = subject.new("abc", "def")
       allow(instance).to receive(:request) do
-        double('Request', :params => {'error_reason' => 'user_denied', 'error' => 'access_denied'})
+        double("Request", :params => {"error_reason" => "user_denied", "error" => "access_denied"})
       end
 
-      expect(instance).to receive(:fail!).with('user_denied', anything)
+      expect(instance).to receive(:fail!).with("user_denied", anything)
       instance.callback_phase
     end
   end
@@ -82,17 +91,17 @@ end
 
 describe OmniAuth::Strategies::OAuth2::CallbackError do
   let(:error) { Class.new(OmniAuth::Strategies::OAuth2::CallbackError) }
-  describe '#message' do
+  describe "#message" do
     subject { error }
-    it 'includes all of the attributes' do
-      instance = subject.new('error', 'description', 'uri')
+    it "includes all of the attributes" do
+      instance = subject.new("error", "description", "uri")
       expect(instance.message).to match(/error/)
       expect(instance.message).to match(/description/)
       expect(instance.message).to match(/uri/)
     end
-    it 'includes all of the attributes' do
+    it "includes all of the attributes" do
       instance = subject.new(nil, :symbol)
-      expect(instance.message).to eq('symbol')
+      expect(instance.message).to eq("symbol")
     end
   end
 end

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-omniauth-oauth2.git



More information about the Pkg-ruby-extras-commits mailing list