require 'test_helper' class PushRoutesUrlParamsAssociationsTest < ActiveSupport::TestCase test "finds multiple params" do url = PushRoutes::PushRouteUrl.new("/usr/test/:id/temp/:test") assert_equal({id: "test", test: "temp"}, url.param_associations) end test "works not at the end" do url = PushRoutes::PushRouteUrl.new("/usr/okay/:id/other_thing") assert_equal( {id: "okay"}, url.param_associations) end test "works not at the end with trailing slash" do url = PushRoutes::PushRouteUrl.new("/usr/okay/:id/other_thing//") assert_equal( {id: "okay"}, url.param_associations) end test "empty if none" do url = PushRoutes::PushRouteUrl.new("/usr/test/") assert url.param_associations.blank? end end