class Totes::Query
Public Class Methods
new(subject)
click to toggle source
# File lib/totes/query.rb, line 6 def initialize(subject) @subject = Totes::Subject.new(subject) end
Public Instance Methods
method_missing(name, *args, &block)
click to toggle source
# File lib/totes/query.rb, line 26 def method_missing(name, *args, &block) Totes::Query.new(@subject.__send__ name, *args, &block) end
must(*args, &block)
click to toggle source
# File lib/totes/query.rb, line 10 def must(*args, &block) if matcher = args[0] __try__ { matcher.test(@subject, fail_on: false) } else OperationsWrapper.new(self, :must) end end
wont(*args, &block)
click to toggle source
# File lib/totes/query.rb, line 18 def wont(*args, &block) if matcher = args[0] __try__ { matcher.test(@subject, fail_on: true) } else OperationsWrapper.new(self, :wont) end end
Private Instance Methods
__try__() { || ... }
click to toggle source
# File lib/totes/query.rb, line 32 def __try__(&block) yield Totes::Reporter.inst.passed self rescue Totes::Error => e Totes::Backtrace.filter e Totes::Reporter.inst.failed e end