blob: b57e829ccabeac4aa07ad587855d0caa5e24227c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
require "isolation/abstract_unit"
module ApplicationTests
class MyQueue
def publish(name, *args)
raise name
end
# Not a full queue implementation
def method_missing(name, *args, &blk)
self
end
end
class NotificationsTest < Test::Unit::TestCase
include ActiveSupport::Testing::Isolation
def setup
build_app
boot_rails
FileUtils.rm_rf("#{app_path}/config/environments")
require "active_support/notifications"
@events = []
add_to_config <<-RUBY
config.notifications.notifier = ActiveSupport::Notifications::Notifier.new(ApplicationTests::MyQueue.new)
RUBY
end
test "new queue is set" do
use_frameworks []
require "#{app_path}/config/environment"
assert_raise RuntimeError do
ActiveSupport::Notifications.publish('foo')
end
end
end
end
|