Sha256: da101477850a5d36b44b28b07021bffa1e4d71b17b00f03e7e147639f5035bda
Contents?: true
Size: 1.34 KB
Versions: 3
Compression:
Stored size: 1.34 KB
Contents
require_relative 'test_helper' # test requires that a redis server actually be running class TriggerTest < ActiveSupport::TestCase setup do @listener = PushRoutesListener.new end test "basic trigger" do @listener.reset Person.create(age: 100) sleep 1 assert_equal 1, @listener.number_of("/people") end test "specific trigger fail" do @listener.reset Person.create(age: 100) Person.last.update(age: 60) sleep 1 assert_equal 0, @listener.number_of("/old_people") end test "specific trigger success" do @listener.reset Person.create(age: 100) Person.last.update(age: 60) Person.last.update(age: 40) Person.last.update(age: 40) Person.last.update(age: 51) sleep 1 assert_equal 2, @listener.number_of("/old_people") end test "specific trigger function success" do @listener.reset Person.create(age: 100) Person.last.update(age: 81) Person.last.update(age: 79) Person.last.update(age: 78) Person.last.update(age: 82) sleep 1 assert_equal 2, @listener.number_of("/old_function") end test "trigger specific age" do @listener.reset Person.create(age: 100) Person.last.update(age: 81) sleep 1 assert_equal 2, @listener.number_of("/people/with_age/100") assert_equal 1, @listener.number_of("/people/with_age/81") end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
push_routes-0.0.8 | test/trigger_test.rb |
push_routes-0.0.7 | test/trigger_test.rb |
push_routes-0.0.6 | test/trigger_test.rb |