Sha256: 775b1bf004b82b961e98f195820b98e14d3cb6c408046297b1c36c1e111e9881

Contents?: true

Size: 438 Bytes

Versions: 19

Compression:

Stored size: 438 Bytes

Contents

RSpec::Matchers.define(:respond_to_boolean) do |method|
  match do |instance|
    instance.respond_to?(method) && is_boolean?(instance.send(method))
  end
  
  description do
    "should respond to #{method} and return boolean"
  end
  
  failure_message_for_should do |instance|
    "expected #{instance.inspect} to respond to #{method} and return boolean"
  end
  
  def is_boolean?(value)
    value == true || value == false
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
mongomodel-0.5.5 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.5.4 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.5.3 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.5.2 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.5.1 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.5.0 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.4.9 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.4.8 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.4.7 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.4.6 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.4.5 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.4.4 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.4.3 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.4.2 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.4.1 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.4.0 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.3.6 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.3.5 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.3.4 spec/support/matchers/respond_to_boolean.rb