houdini/spec/routing/state_code_routing_spec.rb

25 lines
831 B
Ruby
Raw Normal View History

2020-05-19 21:12:13 +00:00
# frozen_string_literal: true
2020-06-12 20:03:43 +00:00
# License: AGPL-3.0-or-later WITH WTO-AP-3.0-or-later
# Full license explanation at https://github.com/houdiniproject/houdini/blob/master/LICENSE
2020-05-19 21:12:13 +00:00
require "rails_helper"
describe 'Routing by state code', type: :routing do
it 'routes by state-codes for lower case' do
expect(post: "/wi/appleton/name").to route_to(
controller: 'nonprofits',
action: "show",
state_code: "wi",
city: "appleton",
name: "name"
)
end
it 'fails to route for an incorrect two letter state' do
expect(post: "/us/appleton/name").to_not be_routable
end
it 'it fails to route if a valid state code is in the middle of the state_code' do
expect(get: '/hoho/cleveland/interesting-name').to_not be_routable
end
end