deputy 0.1.11 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/deputy.gemspec +1 -1
- data/lib/deputy.rb +8 -0
- data/spec/deputy_spec.rb +26 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.12
|
data/deputy.gemspec
CHANGED
data/lib/deputy.rb
CHANGED
@@ -19,6 +19,14 @@ class Scout
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
+
def error(*args)
|
23
|
+
report :error => args.map{|a| a.inspect}.join(', ')
|
24
|
+
end
|
25
|
+
|
26
|
+
def alert(*args)
|
27
|
+
report :alert => args.map{|a| a.inspect}.join(', ')
|
28
|
+
end
|
29
|
+
|
22
30
|
# stub options for now...
|
23
31
|
def option(key)
|
24
32
|
(YAML.load(self.class::OPTIONS)[key.to_s]||{})['default']
|
data/spec/deputy_spec.rb
CHANGED
@@ -15,6 +15,9 @@ class FooPlugin < Scout::Plugin
|
|
15
15
|
EOS
|
16
16
|
end
|
17
17
|
|
18
|
+
class FooPlugin::NestedPlugin < Scout::Plugin
|
19
|
+
end
|
20
|
+
|
18
21
|
class OptionsPlugin < Scout::Plugin
|
19
22
|
OPTIONS=<<-EOS
|
20
23
|
host:
|
@@ -66,6 +69,29 @@ describe Deputy do
|
|
66
69
|
FooPlugin.new.option(:username).should == 'other'
|
67
70
|
end
|
68
71
|
end
|
72
|
+
|
73
|
+
describe :report do
|
74
|
+
it "sends a report" do
|
75
|
+
Deputy.should_receive(:send_report).with("NestedPlugin.x", 1)
|
76
|
+
FooPlugin::NestedPlugin.new.report(:x => 1)
|
77
|
+
end
|
78
|
+
|
79
|
+
it "sends multiple reports" do
|
80
|
+
Deputy.should_receive(:send_report).with("NestedPlugin.x", 1)
|
81
|
+
Deputy.should_receive(:send_report).with("NestedPlugin.y", 2)
|
82
|
+
FooPlugin::NestedPlugin.new.report(:x => 1, 'y' => 2)
|
83
|
+
end
|
84
|
+
|
85
|
+
it "sends alerts" do
|
86
|
+
Deputy.should_receive(:send_report).with("NestedPlugin.alert", '1, "2"')
|
87
|
+
FooPlugin::NestedPlugin.new.alert 1, "2"
|
88
|
+
end
|
89
|
+
|
90
|
+
it "sends errors" do
|
91
|
+
Deputy.should_receive(:send_report).with("NestedPlugin.error", '1, "2"')
|
92
|
+
FooPlugin::NestedPlugin.new.error 1, "2"
|
93
|
+
end
|
94
|
+
end
|
69
95
|
end
|
70
96
|
|
71
97
|
describe :run_plugins do
|