Class: Lolita::Test::Matchers::BeRoutable

Inherits:
Object
  • Object
show all
Defined in:
lib/lolita/test/matchers.rb

Instance Method Summary collapse

Instance Method Details

#failure_messageObject



18
19
20
# File 'lib/lolita/test/matchers.rb', line 18

def failure_message
  "expected #{@url.inspect}#{@method ? " with method #{@method.inspect}" : ""} to be routable"
end

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
12
13
14
15
16
# File 'lib/lolita/test/matchers.rb', line 8

def matches?(actual)
  @actual=actual
  collect_routes
  set_method_and_url
  result=@routes.detect{|route| 
    method_match(route) && @url.to_s.match(route[:path_info])
  }
  !!result
end

#negative_failure_messageObject



21
22
23
# File 'lib/lolita/test/matchers.rb', line 21

def negative_failure_message
  "expected #{@url.inspect}#{@method ? " with method #{@method.inspect}" : ""}  to not be routable"
end