summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spec/mixlib/shellout/helper_spec.rb2
-rw-r--r--spec/spec_helper.rb1
-rw-r--r--spec/support/dependency_helper.rb14
3 files changed, 16 insertions, 1 deletions
diff --git a/spec/mixlib/shellout/helper_spec.rb b/spec/mixlib/shellout/helper_spec.rb
index 977568a..58b95e6 100644
--- a/spec/mixlib/shellout/helper_spec.rb
+++ b/spec/mixlib/shellout/helper_spec.rb
@@ -2,7 +2,7 @@ require "spec_helper"
require "mixlib/shellout/helper"
require "logger"
-describe Mixlib::ShellOut::Helper do
+describe Mixlib::ShellOut::Helper, ruby: ">= 2.3" do
class TestClass
include Mixlib::ShellOut::Helper
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 1f3c818..fb60fe7 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -19,6 +19,7 @@ RSpec.configure do |config|
config.filter_run_excluding windows_only: true unless windows?
config.filter_run_excluding unix_only: true unless unix?
config.filter_run_excluding requires_root: true unless root?
+ config.filter_run_excluding ruby: DependencyProc.with(RUBY_VERSION)
config.run_all_when_everything_filtered = true
diff --git a/spec/support/dependency_helper.rb b/spec/support/dependency_helper.rb
new file mode 100644
index 0000000..f4f1af8
--- /dev/null
+++ b/spec/support/dependency_helper.rb
@@ -0,0 +1,14 @@
+class DependencyProc < Proc
+ attr_accessor :present
+
+ def self.with(present)
+ provided = Gem::Version.new(present.dup)
+ new do |required|
+ !Gem::Requirement.new(required).satisfied_by?(provided)
+ end.tap { |l| l.present = present }
+ end
+
+ def inspect
+ "\"#{present}\""
+ end
+end