Sha256: 66fb033fd55d065d64f1e50fb3526c907dc3e40e1f28df4c970f2a5da6b6d931

Contents?: true

Size: 892 Bytes

Versions: 3

Compression:

Stored size: 892 Bytes

Contents

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

Version data entries

3 entries across 3 versions & 1 rubygems

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