Parent

Methods

Included Modules

Class Index [+]

Quicksearch

RSpec::Matchers::BuiltIn::Exist

Public Class Methods

new(*args) click to toggle source
   # File lib/rspec/matchers/built_in/exist.rb, line 7
7:         def initialize(*args)
8:           super(args)
9:         end

Public Instance Methods

matches?(actual) click to toggle source
    # File lib/rspec/matchers/built_in/exist.rb, line 11
11:         def matches?(actual)
12:           super(actual)
13:           predicates = [:exist?, :exists?].select { |p| actual.respond_to?(p) }
14:           existance_values = predicates.map { |p| actual.send(p, *expected) }
15:           uniq_truthy_values = existance_values.map { |v| !!v }.uniq
16: 
17:           case uniq_truthy_values.size
18:           when 0; raise NoMethodError.new("#{actual.inspect} does not respond to either #exist? or #exists?")
19:           when 1; existance_values.first
20:           else raise "#exist? and #exists? returned different values:\n\n" +
21:             " exist?: #{existance_values.first}\n" +
22:             "exists?: #{existance_values.last}"
23:           end
24:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.