forked from flapjack/flapjack
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnotifier_options_multiplexer_spec.rb
71 lines (56 loc) · 2.77 KB
/
notifier_options_multiplexer_spec.rb
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
require File.join(File.dirname(__FILE__), '..', 'lib', 'flapjack', 'cli', 'notifier')
require File.join(File.dirname(__FILE__), '..', 'lib', 'flapjack', 'patches')
describe "notifier options multiplexer" do
before(:all) do
@config_filename = File.join(File.dirname(__FILE__), 'configs', 'flapjack-notifier.ini')
@recipients_filename = File.join(File.dirname(__FILE__), 'configs', 'recipients.ini')
@couchdb_config_filename = File.join(File.dirname(__FILE__), 'configs', 'flapjack-notifier-couchdb.ini')
end
it "should setup notifier options from specified config file" do
args = ["-c", @config_filename, "-r", @recipients_filename]
config = Flapjack::Notifier::Options.parse(args)
config.notifiers.each do |key, value|
%w(mailer xmpp).include?(key)
end
config.notifier_directories.each do |dir|
%w(/usr/lib/flapjack/notifiers/ /path/to/my/notifiers).include?(dir)
end
end
it "should setup beanstalkd transport options from specified config file" do
args = ["-c", @config_filename, "-r", @recipients_filename]
config = Flapjack::Notifier::Options.parse(args)
config.transport[:backend].should == "beanstalkd"
config.transport[:host].should == "localhost"
config.transport[:port].should == "11300"
end
it "should setup datamapper persistence options from specified config file" do
args = ["-c", @config_filename, "-r", @recipients_filename]
config = Flapjack::Notifier::Options.parse(args)
config.persistence[:backend].should == "data_mapper"
config.persistence[:uri].should == "sqlite3:///tmp/flapjack.db"
end
it "should setup couchdb persistence backend from specified config file" do
args = [ "-c", @couchdb_config_filename, "-r", @recipients_filename ]
config = Flapjack::Notifier::Options.parse(args)
config.persistence[:backend].should == "couchdb"
config.persistence[:host].should == "localhost"
config.persistence[:port].should == "5984"
config.persistence[:version].should == "0.8"
config.persistence[:database].should == "flapjack_production"
end
it "should setup individual notifiers from a specified config file" do
args = [ "-c", @config_filename, "-r", @recipients_filename ]
config = Flapjack::Notifier::Options.parse(args)
config.notifiers.size.should > 0
end
it "should setup notifier directories options from a specified config file" do
args = [ "-c", @config_filename, "-r", @recipients_filename ]
config = Flapjack::Notifier::Options.parse(args)
config.notifier_directories.size.should > 0
end
it "should setup recipients from a specified config file" do
args = [ "-c", @config_filename, "-r", @recipients_filename ]
config = Flapjack::Notifier::Options.parse(args)
config.recipients.size.should > 0
end
end