Class: RouteMechanic::RSpec::Matchers::HaveValidRoutes

Inherits:
BaseMatcher
  • Object
show all
Defined in:
lib/route_mechanic/rspec/matchers/have_valid_routes.rb

Instance Attribute Summary

Attributes included from Testing::Methods::MinitestCounters

#assertions

Instance Method Summary collapse

Methods inherited from BaseMatcher

#failure_message, #initialize

Methods included from Testing::Methods

#assert_all_routes, #assert_no_unused_actions, #assert_no_unused_routes

Constructor Details

This class inherits a constructor from RouteMechanic::RSpec::Matchers::BaseMatcher

Instance Method Details

#descriptionObject



15
16
17
# File 'lib/route_mechanic/rspec/matchers/have_valid_routes.rb', line 15

def description
  "have valid routes"
end

#matches?(_actual) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
10
11
12
13
# File 'lib/route_mechanic/rspec/matchers/have_valid_routes.rb', line 7

def matches?(_actual)
  # assert_recognizes does not consider ActionController::RoutingError an
  # assertion failure, so we have to capture that and Assertion here.
  match_unless_raises Minitest::Assertion, ActiveSupport::TestCase::Assertion, ActionController::RoutingError do
    assert_all_routes(@expected)
  end
end