require 'test_helper' class NotificationStringTest < ActiveSupport::TestCase test "no_params_okay" do url = PushRoutes::PushRouteUrl.new("/people") assert url.notification_string(true)=="/people" end test "no_params_okay_false" do url = PushRoutes::PushRouteUrl.new("/people") assert url.notification_string(false)=="/people" end test "params_okay" do url = PushRoutes::PushRouteUrl.new("/people/:id/okay") res = url.notification_string({id: 431}) assert_equal "/people/431/okay", res end test "params_not_hash" do assert_raise ArgumentError do url = PushRoutes::PushRouteUrl.new("/people/:id/okay") url.notification_string(true) end end test "params_wrong_key" do assert_raise ArgumentError do url = PushRoutes::PushRouteUrl.new("/people/:id/okay") url.notification_string({idd: 432}) end end end