deputy 0.1.11 → 0.1.12

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.11
1
+ 0.1.12
data/deputy.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{deputy}
8
- s.version = "0.1.11"
8
+ s.version = "0.1.12"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Michael Grosser"]
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
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 11
9
- version: 0.1.11
8
+ - 12
9
+ version: 0.1.12
10
10
  platform: ruby
11
11
  authors:
12
12
  - Michael Grosser