Sha256: 41de78f79d64c56b5ae52eeca51bc9396cc1093853147c301d605ce9f3408079

Contents?: true

Size: 744 Bytes

Versions: 3

Compression:

Stored size: 744 Bytes

Contents

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
push_routes-0.0.8 test/push_routes_url_params_associations_test.rb
push_routes-0.0.7 test/push_routes_url_params_associations_test.rb
push_routes-0.0.6 test/push_routes_url_params_associations_test.rb