Sha256: 7a0f208fad66a650e2f059dcef4eaf162e6752b947965f9a27dd50a42555e299

Contents?: true

Size: 841 Bytes

Versions: 3

Compression:

Stored size: 841 Bytes

Contents

require 'test_helper'


class SmarterAddTest < ActiveSupport::TestCase
  setup do
    @listener = PushRoutesListener.new
  end

  test "allows adding id triggers" do
    assert_equal "/clubs/:id/list", ClubsController.push_routes[:list].to_s
  end

  test "id triggers actually fire" do
    @listener.reset
    Person.create(club_id: 20)
    sleep 1
    assert_equal 1, @listener.number_of("/clubs/20/list")
  end

  test "the id triggers with infered response type" do
    @listener.reset
    @club = Club.create
    Person.create(club: @club)
    sleep 1
    assert_equal 1, @listener.number_of("/clubs/#{@club.id}/people")
  end

  test "the id triggers with infered response type and infered trigger type" do
    @listener.reset
    @club = Club.create
    sleep 1
    assert_equal 1, @listener.number_of("/clubs/#{@club.id}")
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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