How do I spec rails3 routing constraints?
My Cucumber features pass whatever subdomain I pass in. Not sure where
or how to spec the subdomain. Any help would be appreciated.
I have something like the following:
#features/create_account.feature
Scenario:
Given I visit subdomain "www"
And I go to the new account page
#accounts_controller_spec.rb
describe AccountsController do
describe "GET new" do
before(:each) do
get :new
end
it "should render new.html.haml" do
response.should render_template(:new)
end
end
end
#routes.rb
constraints Promotional do
resource :account, :only => :new
end
#lib/promotional.rb
class Promotional
def self.matches?(request)
request.subdomain.empty? || request.subdomain == "www"
end
end
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users