mirror of
https://github.com/thoughtbot/shoulda-matchers.git
synced 2022-11-09 12:01:38 -05:00

Why: * The `route` matcher can not only be used within controller example groups but also routing example groups. * Now that we are mixing matchers into specific example groups, `route` is no longer available in routing example groups. To satisfy the above: * Create a new module that contains a `route` method and returns a new instance of RouteMatcher. (RouteMatcher still lives in the ActionController namespace.) * Mix this module into routing example groups when the gem configuration block is run.
27 lines
602 B
Ruby
27 lines
602 B
Ruby
module Shoulda
|
|
module Matchers
|
|
module Integrations
|
|
module Libraries
|
|
# @private
|
|
class Routing
|
|
Integrations.register_library(self, :routing)
|
|
|
|
include Integrations::Inclusion
|
|
include Integrations::Rails
|
|
|
|
def integrate_with(test_framework)
|
|
test_framework.include(matchers_module, type: :routing)
|
|
|
|
include_into(::ActionController::TestCase, matchers_module)
|
|
end
|
|
|
|
private
|
|
|
|
def matchers_module
|
|
Shoulda::Matchers::Routing
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|