Module: Rspec::PendingFor

Defined in:
lib/rspec/pending_for.rb,
lib/rspec/pending_for/build.rb,
lib/rspec/pending_for/version.rb,
lib/rspec/pending_for/engine_or_versions_required.rb

Overview

Use with Rspec by including in your example groups, just like any other Rspec helpers:

RSpec.configure do |c|
  c.include Rspec::PendingFor
end

Defined Under Namespace

Modules: Version Classes: Build, EngineOrVersionsRequired

Constant Summary collapse

VERSION =

Backwards compatability shim.

Version::VERSION

Instance Method Summary collapse

Instance Method Details

#pending_for(options = {}) ⇒ Object

How to pend specs that break due to bugs in Ruby interpreters or versions

it("blah is blah") do
  pending_for(engine: "ruby", versions: "2.1.5")
  expect("blah").to eq "blah"
end

Not using named parameters because still supporting Ruby 1.9

Parameters:

  • options (Hash) (defaults to: {})

    pending configuration

Options Hash (options):

  • :engine (String, Symbol) — default: "ruby"

    Ruby engine name to match, e.g. :ruby, :jruby, :truffleruby

  • :versions (String, Range, Array<String,Range>)

    A single version string or range, or an Array of version specs. Each spec can be:

    • String: exact version match (e.g., “2.7.8”)

    • Range<Gem::Version>: inclusive/exclusive bounds respected (e.g., Gem::Version.new(“2.6.0”)…Gem::Version.new(“3.0.0”))

    • Range<Integer>: compares Ruby major version (e.g., 2..3). Inclusive/exclusive respected.

    JRuby/TruffleRuby are supported via RUBY_VERSION compatibility for Integer ranges and Gem::Version ranges.

  • :reason (String)

    Custom message to display when pending



39
40
41
# File 'lib/rspec/pending_for.rb', line 39

def pending_for(options = {})
  modify_example_with(:pending, options)
end

#skip_for(options = {}) ⇒ Object

How to pend specs that break due to bugs in Ruby interpreters or versions

it("blah is blah") do
  skip_for(engine: "jruby", versions: "2.2.2")
  expect("blah").to eq "blah"
end

Not using named parameters because still supporting Ruby 1.9

Parameters:

  • options (Hash) (defaults to: {})

    skip configuration

Options Hash (options):

  • :engine (String, Symbol) — default: "ruby"

    Ruby engine name to match, e.g. :ruby, :jruby, :truffleruby

  • :versions (String, Range, Array<String,Range>)

    A single version string or range, or an Array of version specs. Each spec can be:

    • String: exact version match (e.g., “2.7.8”)

    • Range<Gem::Version>: inclusive/exclusive bounds respected (e.g., Gem::Version.new(“2.6.0”)…Gem::Version.new(“3.0.0”))

    • Range<Integer>: compares Ruby major version (e.g., 2..3). Inclusive/exclusive respected.

    JRuby/TruffleRuby are supported via RUBY_VERSION compatibility for Integer ranges and Gem::Version ranges.

  • :reason (String)

    Custom message to display when skipping



61
62
63
# File 'lib/rspec/pending_for.rb', line 61

def skip_for(options = {})
  modify_example_with(:skip, options)
end