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.3.3 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.3.2 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.3.1 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.3.0 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.2.20 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.2.19 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.2.18 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.2.17 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.2.16 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.2.15 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.2.14 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.2.13 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.2.12 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.2.11 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.2.10 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.2.9 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.2.8 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.2.7 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.2.6 spec/support/matchers/respond_to_boolean.rb
mongomodel-0.2.5 spec/support/matchers/respond_to_boolean.rb