Method: Object#unspecified

Defined in:
lib/mspec/guards/specified.rb

#unspecifiedObject

This guard wraps one or more #specified_on guards to group them and document the specs. The purpose of the guard is for situations where MRI either does not specify Ruby behavior or where MRI’s behavior is all but impossible to spec, for example due to relying on platform-specific behavior that is not easily testable from Ruby code. In such cases, it may be desirable for implementations to explore a specified set of behaviors that are explicitly documented in the specs.

unspecified do
  specified_on :rubinius, :ironruby do
    it "returns true when passed :foo" do
      # ...
    end

    it "returns false when passed :bar" do
      # ...
    end
  end

  specified_on :jruby do
    it "returns true when passed :bar" do
      # ...
    end
  end
end

Note that these guards do not change the policy of the #compliant_on, #not_compliant_on, #deviates_on, #extended_on, and #not_supported_on guards.



49
50
51
52
53
54
55
# File 'lib/mspec/guards/specified.rb', line 49

def unspecified
  g = UnspecifiedGuard.new
  g.name = :unspecified
  yield if g.yield?
ensure
  g.unregister
end