Sha256: 58121414c94f10ed1374c411b31bb35fa29893b95c40c4176ffc3a6cf4df45b7

Contents?: true

Size: 925 Bytes

Versions: 38

Compression:

Stored size: 925 Bytes

Contents

RSpec::Matchers.define :be_valid_option do |_|
  match do |actual|
    subject.option?(actual)
  end

  failure_message do |actual|
    format("expected that \"%s\" is a valid option", actual)
  end

  failure_message_when_negated do |actual|
    format("expected that \"%s\" is not a valid option", actual)
  end
end

RSpec::Matchers.define :have_option_value do |expected|
  match do |actual|
    @old_actual = actual
    @actual     = if RUBY_VERSION < '1.9'
                    subject.send(actual.to_sym)
                  else
                    subject.public_send(actual.to_sym)
                  end
    values_match? expected, @actual
  end

  diffable

  failure_message do |_actual|
    format(%(expected that option "%s" has value "%s"), @old_actual, expected)
  end

  failure_message_when_negated do |_actual|
    format(%(expected that option "%s" does not have value "%s"), @old_actual, expected)
  end
end

Version data entries

38 entries across 38 versions & 3 rubygems

Version Path
aruba-0.11.1 spec/support/matchers/option.rb
aruba-0.11.0.pre4 spec/support/matchers/option.rb
aruba-0.11.0.pre3 spec/support/matchers/option.rb
aruba-0.11.0.pre2 spec/support/matchers/option.rb
aruba-0.11.0.pre spec/support/matchers/option.rb
aruba-0.10.2 spec/support/matchers/option.rb
aruba-0.10.1 spec/support/matchers/option.rb
aruba-0.10.0 spec/support/matchers/option.rb
aruba-0.10.0.pre2 spec/support/matchers/option.rb
aruba-0.10.0.pre spec/support/matchers/option.rb
aruba-0.9.0 spec/support/matchers/option.rb
aruba-0.9.0.pre2 spec/support/matchers/option.rb
aruba-0.9.0.pre spec/support/matchers/option.rb
aruba-0.8.1 spec/support/matchers/option.rb
aruba-0.8.0 spec/support/matchers/option.rb
aruba-0.8.0.pre3 spec/support/matchers/option.rb
aruba-0.8.0.pre2 spec/support/matchers/option.rb
aruba-0.8.0.pre spec/support/matchers/option.rb