This project is archived and is in readonly mode.
Threre is no way to test routing with constraints
-
saks
- Tag changed from routing testing constraints to routing, testing
I have no any idea about how to test these routes:
constraints(:host => /^catalog\./) do get 'categories' => 'categories#index' get 'categories/:url_name' => 'categories#show' endbecauses i don't see the way to change
hostfor this request. It is hardcoded to be 'example.org':# Return the Rack environment used for a request to +uri+. def self.env_for(uri="", opts={}) uri = URI(uri) uri.path = "/#{uri.path}" unless uri.path[0] == ?/ env = DEFAULT_ENV.dup env["REQUEST_METHOD"] = opts[:method] ? opts[:method].to_s.upcase : "GET" env["SERVER_NAME"] = uri.host || "example.org" -
saks
- Tag changed from routing, testing to constraints, routing, testing
def assert_generates(expected_path, options, defaults={}, extras = {}, message=nil)
expected_path = "/#{expected_path}" unless expected_path[0] == ?/ # Load routes.rb if it hasn't been loaded."/#{expected_path}... does not allow to pass path like "http://test.host.com/books", That's why URI(uri) cannot parse host
-
saks
- Assigned user set to DHH
-
Anil Wadghule
- Title changed from Threre is no way to test roting with constraints to Threre is no way to test routing with constraints
-
José Valim
- Assigned user changed from DHH to josh
- Milestone cleared.
@saks, please don't assign users. Wait until someone comes and assign it properly.
-
josh
- State changed from new to invalid