Sha256: 70da7771de44c241b1657853bda634ab5cd6d53e0d87a3ef8d56fbf213f3ebc6

Contents?: true

Size: 437 Bytes

Versions: 31

Compression:

Stored size: 437 Bytes

Contents

Spec::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

31 entries across 31 versions & 1 rubygems

Version Path
mongomodel-0.2.4 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.2.3 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.2.2 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.2.1 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.2.0 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.1.6 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.1.5 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.1.4 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.1.3 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.1.1 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.1 spec/support/matchers/respond_to_boolean.rb