1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activeresource/test/cases/subscriber_test.rb

30 lines
854 B
Ruby
Raw Normal View History

2010-01-13 16:59:27 -05:00
require "abstract_unit"
require "fixtures/person"
require "rails/subscriber/test_helper"
require "active_resource/railties/subscriber"
2010-01-21 07:05:30 -05:00
class SubscriberTest < ActiveSupport::TestCase
include Rails::Subscriber::TestHelper
2010-01-13 16:59:27 -05:00
Rails::Subscriber.add(:active_resource, ActiveResource::Railties::Subscriber.new)
def setup
@matz = { :id => 1, :name => 'Matz' }.to_xml(:root => 'person')
ActiveResource::HttpMock.respond_to do |mock|
mock.get "/people/1.xml", {}, @matz
end
super
end
def set_logger(logger)
ActiveResource::Base.logger = logger
end
def test_request_notification
matz = Person.find(1)
wait
assert_equal 2, @logger.logged(:info).size
assert_equal "GET http://somewhere.else:80/people/1.xml", @logger.logged(:info)[0]
assert_match /\-\-\> 200 200 106/, @logger.logged(:info)[1]
end
end