Class: Remarkable::Controller::Matchers::Route
- Inherits:
-
Matcher::Base
- Object
- Matcher::Base
- Remarkable::Controller::Matchers::Route
- Defined in:
- lib/remarkable/controller/macros/route_matcher.rb
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(method, path, options) ⇒ Route
constructor
A new instance of Route.
- #matches?(subject) ⇒ Boolean
Methods inherited from Matcher::Base
#failure_message, #negative, #negative_failure_message, #spec
Methods included from Matcher::DSL
Constructor Details
#initialize(method, path, options) ⇒ Route
Returns a new instance of Route.
5 6 7 8 9 |
# File 'lib/remarkable/controller/macros/route_matcher.rb', line 5 def initialize(method, path, ) @method = method @path = path @options = end |
Instance Method Details
#description ⇒ Object
35 36 37 |
# File 'lib/remarkable/controller/macros/route_matcher.rb', line 35 def description expectation end |
#matches?(subject) ⇒ Boolean
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/remarkable/controller/macros/route_matcher.rb', line 11 def matches?(subject) @subject = subject initialize_with_spec! unless @options[:controller] @options[:controller] = @controller.class.name.gsub(/Controller$/, '').tableize end @options[:controller] = @options[:controller].to_s @options[:action] = @options[:action].to_s @populated_path = @path.dup @options.each do |key, value| @options[key] = value.to_param if value.respond_to?(:to_param) @populated_path.gsub!(key.inspect, value.to_s) end ActionController::Routing::Routes.reload if ActionController::Routing::Routes.empty? assert_matcher do map_to_path? && generate_params? end end |