Class: RSpec::Rails::ViewPathBuilder
Relationships & Source Files | |
Inherits: | Object |
Defined in: | rspec-rails/lib/rspec/rails/view_path_builder.rb |
Overview
Builds paths for view specs using a particular route set.
Class Method Summary
- .new(route_set) ⇒ ViewPathBuilder constructor
Instance Method Summary
-
#path_for(path_params)
Given a hash of parameters, build a view path, if possible.
Constructor Details
.new(route_set) ⇒ ViewPathBuilder
# File 'rspec-rails/lib/rspec/rails/view_path_builder.rb', line 5
def initialize(route_set) self.class.send(:include, route_set.url_helpers) end
Instance Method Details
#path_for(path_params)
Given a hash of parameters, build a view path, if possible. Returns nil if no path can be built from the given params.
# File 'rspec-rails/lib/rspec/rails/view_path_builder.rb', line 22
def path_for(path_params) url_for(path_params.merge(only_path: true)) rescue => e e. end