Sha256: b09731dbe5945aea4ad0b807790274f303f1a93198c24cbc5f27a086a2eabd75

Contents?: true

Size: 1.17 KB

Versions: 3

Compression:

Stored size: 1.17 KB

Contents

require 'test_helper'


class EnableRoutesTest < ActiveSupport::TestCase
  test "basic path" do
    assert_equal "people", PeopleController.controller_path
  end

  test "nested path" do
    assert_equal "push_routes/nested", PushRoutes::NestedController.controller_path
  end

  test "basic url" do
    assert_equal "/people", PeopleController.push_routes[:index].to_s
  end

  test "url with params" do
    assert_equal "/push_routes/nested/:id", PushRoutes::NestedController.push_routes[:nested_function].to_s    
  end

  test "added url" do
    assert_equal "/new_route", PushRoutes::NestedController.push_routes[:added_function].to_s    
  end

  test "add_on_existing_url_error" do
    assert_raise ArgumentError do
      PeopleController.enable_push_route :index, "/people2"
    end
  end

  test "doesn't let you enable action with no routes" do
    assert_raise ArgumentError do
      PeopleController.enable_push_route :not_exist
    end
  end

  test "add_on_twice" do
    assert_raise ArgumentError do
      PeopleController.enable_push_route :index
    end
  end

  test "can add witout explecit enable" do
    assert_equal "/socket", SocketsController.push_routes[:test].to_s
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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