summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hashie.gemspec1
-rw-r--r--spec/hashie/mash_spec.rb1
-rw-r--r--spec/spec_helper.rb1
-rw-r--r--spec/support/ruby_version.rb59
4 files changed, 2 insertions, 60 deletions
diff --git a/hashie.gemspec b/hashie.gemspec
index eaeeda4..6e49b67 100644
--- a/hashie.gemspec
+++ b/hashie.gemspec
@@ -18,4 +18,5 @@ Gem::Specification.new do |gem|
gem.add_development_dependency 'rake'
gem.add_development_dependency 'rspec', '~> 3.0'
+ gem.add_development_dependency 'rspec-pending_for', '~> 0.1'
end
diff --git a/spec/hashie/mash_spec.rb b/spec/hashie/mash_spec.rb
index 213c47f..ea3d089 100644
--- a/spec/hashie/mash_spec.rb
+++ b/spec/hashie/mash_spec.rb
@@ -1,6 +1,5 @@
require 'spec_helper'
require 'delegate'
-require 'support/ruby_version'
describe Hashie::Mash do
subject { Hashie::Mash.new }
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 7c07c4a..e1bcd13 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -7,6 +7,7 @@ require 'pry'
require 'rspec'
require 'hashie'
+require 'rspec/pending_for'
RSpec.configure do |config|
config.expect_with :rspec do |expect|
diff --git a/spec/support/ruby_version.rb b/spec/support/ruby_version.rb
deleted file mode 100644
index 7642e77..0000000
--- a/spec/support/ruby_version.rb
+++ /dev/null
@@ -1,59 +0,0 @@
-# How to pend specs that break due to bugs in Ruby interpreters or versions
-#
-# it("blah is blah") do
-# pending_for(engine: 'jruby', version: '2.2.2')
-# expect('blah').to eq 'blah'
-# end
-#
-def pending_for(options = {}) # Not using named parameters because still supporting Ruby 1.9
- fail ArgumentError, 'pending_for requires at least an engine or versions to be specified' unless
- options[:engine] || options[:versions]
- current_engine, current_version = ruby_engine_and_version
- versions_to_pend = Array(options[:versions]) # cast to array
- engine_to_pend = options[:engine]
- broken = 'This behavior is broken'
- bug = 'due to a bug in the Ruby engine'
- # If engine is nil, then any matching versions should be pended
- if engine_to_pend.nil?
- pending "#{broken} in Ruby versions #{versions_to_pend} #{bug}" if
- versions_to_pend.include?(current_version)
- elsif engine_to_pend == current_engine
- if versions_to_pend.empty?
- pending "#{broken} #{bug} #{INTERPRETER_MATRIX[engine_to_pend]}"
- else
- pending %[#{broken} in Ruby versions #{versions_to_pend} #{bug} (#{INTERPRETER_MATRIX[engine_to_pend]})] if
- versions_to_pend.include?(current_version)
- end
- end
-end
-
-#
-# | RUBY_ENGINE | Implementation |
-# |:-----------:|:-----------------:|
-# | <undefined> | MRI < 1.9 |
-# | 'ruby' | MRI >= 1.9 or REE |
-# | 'jruby' | JRuby |
-# | 'macruby' | MacRuby |
-# | 'rbx' | Rubinius |
-# | 'maglev' | MagLev |
-# | 'ironruby' | IronRuby |
-# | 'cardinal' | Cardinal |
-#
-
-INTERPRETER_MATRIX = {
- nil => 'MRI < 1.9',
- 'ruby' => 'MRI >= 1.9 or REE',
- 'jruby' => 'JRuby',
- 'macruby' => 'MacRuby',
- 'rbx' => 'Rubinius',
- 'maglev' => 'MagLev',
- 'ironruby' => 'IronRuby',
- 'cardinal' => 'Cardinal'
-}
-
-def ruby_engine_and_version
- current_engine = Object.const_defined?(:RUBY_ENGINE) && RUBY_ENGINE
- current_version = Object.const_defined?(:RUBY_VERSION) && RUBY_VERSION
-
- [current_engine, current_version]
-end