diff options
author | Michael Herold <michael.j.herold+github@gmail.com> | 2017-01-31 12:18:30 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-31 12:18:30 -0600 |
commit | 6b84df465efe811232edfaac4781850e9cb54934 (patch) | |
tree | 3a9a94556c8a2eeae7814b141e1cd77e03eeed35 | |
parent | 3ec07c87281344ed64d814e588c5dc7ed03e7203 (diff) | |
parent | c4ae0a944fac0fa47e2eaf3343d372f14595c84c (diff) | |
download | hashie-6b84df465efe811232edfaac4781850e9cb54934.tar.gz |
Merge pull request #392 from dblock/omniauth-integration-spec
Added omniauth integration spec for #391.
-rw-r--r-- | .travis.yml | 5 | ||||
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | Rakefile | 1 | ||||
-rw-r--r-- | lib/hashie.rb | 16 | ||||
-rw-r--r-- | lib/hashie/extensions/ruby_version_check.rb | 2 | ||||
-rw-r--r-- | lib/hashie/logger.rb | 16 | ||||
-rw-r--r-- | lib/hashie/mash.rb | 2 | ||||
-rw-r--r-- | spec/integration/omniauth/.rspec | 3 | ||||
-rw-r--r-- | spec/integration/omniauth/Gemfile | 7 | ||||
-rw-r--r-- | spec/integration/omniauth/integration_spec.rb | 37 |
10 files changed, 75 insertions, 15 deletions
diff --git a/.travis.yml b/.travis.yml index 15118f7..499c299 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,6 +20,11 @@ matrix: - bundle exec danger after_script: - bundle exec codeclimate-test-reporter + - rvm: 2.3.1 + install: + - for dir in spec/integration/*; do BUNDLE_GEMFILE=$dir/Gemfile bundle; done + script: + - for dir in spec/integration/*; do BUNDLE_GEMFILE=$dir/Gemfile bundle exec rspec $dir; done allow_failures: - rvm: ruby-head - rvm: jruby-head diff --git a/CHANGELOG.md b/CHANGELOG.md index 69c59e1..b3a056e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ scheme are considered to be bugs. ### Fixed +* [#392](https://github.com/intridea/hashie/pull/392): Fix for #391: Require all dependencies of Hashie::Mash - [@dblock](https://github.com/dblock). * Your contribution here. ### Security @@ -7,6 +7,7 @@ Bundler::GemHelper.install_tasks require 'rspec/core/rake_task' RSpec::Core::RakeTask.new do |spec| spec.pattern = 'spec/**/*_spec.rb' + spec.exclude_pattern = 'spec/integration/**/*_spec.rb' end require 'rubocop/rake_task' diff --git a/lib/hashie.rb b/lib/hashie.rb index ba51861..6941c32 100644 --- a/lib/hashie.rb +++ b/lib/hashie.rb @@ -2,21 +2,7 @@ require 'logger' require 'hashie/version' module Hashie - # The logger that Hashie uses for reporting errors. - # - # @return [Logger] - def self.logger - @logger ||= Logger.new(STDOUT) - end - - # Sets the logger that Hashie uses for reporting errors. - # - # @param logger [Logger] The logger to set as Hashie's logger. - # @return [void] - def self.logger=(logger) - @logger = logger - end - + autoload :Logger, 'hashie/logger' autoload :Clash, 'hashie/clash' autoload :Dash, 'hashie/dash' autoload :Hash, 'hashie/hash' diff --git a/lib/hashie/extensions/ruby_version_check.rb b/lib/hashie/extensions/ruby_version_check.rb index bdf86a4..bcd3436 100644 --- a/lib/hashie/extensions/ruby_version_check.rb +++ b/lib/hashie/extensions/ruby_version_check.rb @@ -1,3 +1,5 @@ +require 'hashie/extensions/ruby_version' + module Hashie module Extensions module RubyVersionCheck diff --git a/lib/hashie/logger.rb b/lib/hashie/logger.rb new file mode 100644 index 0000000..4731fb9 --- /dev/null +++ b/lib/hashie/logger.rb @@ -0,0 +1,16 @@ +module Hashie + # The logger that Hashie uses for reporting errors. + # + # @return [Logger] + def self.logger + @logger ||= Logger.new(STDOUT) + end + + # Sets the logger that Hashie uses for reporting errors. + # + # @param logger [Logger] The logger to set as Hashie's logger. + # @return [void] + def self.logger=(logger) + @logger = logger + end +end diff --git a/lib/hashie/mash.rb b/lib/hashie/mash.rb index 67143c6..c84fa92 100644 --- a/lib/hashie/mash.rb +++ b/lib/hashie/mash.rb @@ -1,5 +1,7 @@ require 'hashie/hash' require 'hashie/array' +require 'hashie/utils' +require 'hashie/logger' module Hashie # Mash allows you to create pseudo-objects that have method-like diff --git a/spec/integration/omniauth/.rspec b/spec/integration/omniauth/.rspec new file mode 100644 index 0000000..a4c51e7 --- /dev/null +++ b/spec/integration/omniauth/.rspec @@ -0,0 +1,3 @@ +--colour +--format=documentation +--pattern=*_spec.rb diff --git a/spec/integration/omniauth/Gemfile b/spec/integration/omniauth/Gemfile new file mode 100644 index 0000000..5e656f8 --- /dev/null +++ b/spec/integration/omniauth/Gemfile @@ -0,0 +1,7 @@ +source 'http://rubygems.org' + +gem 'hashie', path: '../../..' +gem 'omniauth', '~> 1.3.2' +gem 'sinatra' +gem 'rspec', '~> 3.5.0' +gem 'rack-test', '~> 0.6.3' diff --git a/spec/integration/omniauth/integration_spec.rb b/spec/integration/omniauth/integration_spec.rb new file mode 100644 index 0000000..469dd6e --- /dev/null +++ b/spec/integration/omniauth/integration_spec.rb @@ -0,0 +1,37 @@ +ENV['RACK_ENV'] = 'test' + +require 'rspec/core' +require 'rack/test' +require 'sinatra' +require 'omniauth' + +class MyApplication < Sinatra::Base + use Rack::Session::Cookie + use OmniAuth::Strategies::Developer + + get '/' do + 'Hello World' + end +end + +module RSpecMixin + include Rack::Test::Methods + def app + MyApplication + end +end + +RSpec.configure do |config| + config.include RSpecMixin + config.expect_with :rspec do |expect| + expect.syntax = :expect + end +end + +describe 'omniauth' do + it 'works' do + get '/' + expect(last_response).to be_ok + expect(last_response.body).to eq 'Hello World' + end +end |