sensu-extensions 0.0.5 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6f22bdfd2101a4eed988383d6e556628c8aebbb9
4
- data.tar.gz: 9fb6182c93f47b801663a53a3ff97949f00a7842
3
+ metadata.gz: 4f57126991763e89e26528b447af7a360ef8dc68
4
+ data.tar.gz: 0544fed9f3a43312082531cf59db8ddae44f2fc0
5
5
  SHA512:
6
- metadata.gz: 37554eff083995189efe88e118a62535f816b51748a7b9139b5aa0138ecdd2eace226d3e952445cd12ab3ddf0b3ef1a40cfa0bf45354d68735fe8477c9ddb079
7
- data.tar.gz: 42e83135922064522c13ff2c02635a7a60bc5dab13401545420841e4e29611fce4580d3dd0df9dcb6a6d75c6a5bcda584d200c19d198ff6d515793200970c228
6
+ metadata.gz: 12db8e2e16ac764b716d58f2745c067c8b7550f66dbd7de5397ca76be5855c7de2f0140cccff865ddcf2a657d0f539778dca3a3721485f9b8a350ab48018303d
7
+ data.tar.gz: 330bff41a52ef0283f81fc47623d7b2c5b746e702132f4a97dd9aa7c00f55ef400d2326feca48c8d512a55ab8313aebc2fd8fd4c9963f5c06a1f8dfd97151bb7
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "sensu-extensions"
5
- spec.version = "0.0.5"
5
+ spec.version = "1.0.0"
6
6
  spec.authors = ["Sean Porter"]
7
7
  spec.email = ["portertech@gmail.com"]
8
8
  spec.summary = "The Sensu extension loader library"
@@ -11,52 +11,52 @@ describe "Sensu::Extensions" do
11
11
  end
12
12
 
13
13
  it "can provide the extensions API" do
14
- Sensu::Extensions.should respond_to(:load)
14
+ expect(Sensu::Extensions).to respond_to(:load)
15
15
  end
16
16
 
17
17
  it "can provide an instance of Loader" do
18
18
  extensions = Sensu::Extensions.load
19
- extensions.should be_instance_of(Sensu::Extensions::Loader)
20
- extensions.loaded_files.should be_empty
19
+ expect(extensions).to be_instance_of(Sensu::Extensions::Loader)
20
+ expect(extensions.loaded_files).to be_empty
21
21
  end
22
22
 
23
23
  it "can retrive the current loaded loader" do
24
24
  extensions = Sensu::Extensions.load
25
- Sensu::Extensions.get.should eq(extensions)
26
- Sensu::Extensions.get.should eq(extensions)
25
+ expect(Sensu::Extensions.get).to eq(extensions)
26
+ expect(Sensu::Extensions.get).to eq(extensions)
27
27
  end
28
28
 
29
29
  it "can load up a loader if one doesn't exist" do
30
30
  extensions = Sensu::Extensions.get
31
- extensions.should be_an_instance_of(Sensu::Extensions::Loader)
32
- Sensu::Extensions.get.should eq(extensions)
31
+ expect(extensions).to be_an_instance_of(Sensu::Extensions::Loader)
32
+ expect(Sensu::Extensions.get).to eq(extensions)
33
33
  end
34
34
 
35
35
  it "can load an extension from a file" do
36
36
  extensions = Sensu::Extensions.load(:extension_file => @extension_file)
37
- extensions.loaded_files.size.should eq(1)
38
- extensions.handler_exists?("test").should be_true
37
+ expect(extensions.loaded_files.size).to eq(1)
38
+ expect(extensions.handler_exists?("test")).to be(true)
39
39
  end
40
40
 
41
41
  it "can load extensions from a directory" do
42
42
  extensions = Sensu::Extensions.load(:extension_dir => @extension_dir)
43
- extensions.loaded_files.size.should eq(2)
44
- extensions.handler_exists?("test").should be_true
45
- extensions.check_exists?("mock_check").should be_true
43
+ expect(extensions.loaded_files.size).to eq(2)
44
+ expect(extensions.handler_exists?("test")).to be(true)
45
+ expect(extensions.check_exists?("mock_check")).to be(true)
46
46
  end
47
47
 
48
48
  it "can load extensions from one or more directories" do
49
49
  extensions = Sensu::Extensions.load(:extension_dirs => [@extension_dir])
50
- extensions.loaded_files.size.should eq(2)
51
- extensions.handler_exists?("test").should be_true
52
- extensions.check_exists?("mock_check").should be_true
50
+ expect(extensions.loaded_files.size).to eq(2)
51
+ expect(extensions.handler_exists?("test")).to be(true)
52
+ expect(extensions.check_exists?("mock_check")).to be(true)
53
53
  end
54
54
 
55
55
  it "can load the built-in extensions" do
56
56
  extensions = Sensu::Extensions.load
57
- extensions.mutator_exists?("json").should be_true
58
- extensions.mutator_exists?("ruby_hash").should be_true
59
- extensions.mutator_exists?("only_check_output").should be_true
60
- extensions.handler_exists?("debug").should be_true
57
+ expect(extensions.mutator_exists?("json")).to be(true)
58
+ expect(extensions.mutator_exists?("ruby_hash")).to be(true)
59
+ expect(extensions.mutator_exists?("only_check_output")).to be(true)
60
+ expect(extensions.handler_exists?("debug")).to be(true)
61
61
  end
62
62
  end
@@ -17,8 +17,8 @@ describe "Sensu::Extension::Debug" do
17
17
  }
18
18
  }
19
19
  @extension.safe_run(event) do |output, status|
20
- output.should eq(event)
21
- status.should eq(0)
20
+ expect(output).to eq(event)
21
+ expect(status).to eq(0)
22
22
  end
23
23
  end
24
24
  end
@@ -12,86 +12,86 @@ describe "Sensu::Extensions::Loader" do
12
12
  end
13
13
 
14
14
  it "can provide the extensions loader API" do
15
- @loader.should respond_to(:load_file, :load_directory, :load_instances,
16
- :warnings, :loaded_files, :[], :all,
17
- :bridges, :checks, :mutators, :handlers)
15
+ expect(@loader).to respond_to(:load_file, :load_directory, :load_instances,
16
+ :warnings, :loaded_files, :[], :all,
17
+ :bridges, :checks, :mutators, :handlers)
18
18
  end
19
19
 
20
20
  it "can load an extension from a file" do
21
21
  @loader.load_file(@extension_file)
22
- @loader.warnings.size.should eq(1)
23
- @loader.loaded_files.size.should eq(1)
24
- @loader.loaded_files.first.should eq(File.expand_path(@extension_file))
22
+ expect(@loader.warnings.size).to eq(1)
23
+ expect(@loader.loaded_files.size).to eq(1)
24
+ expect(@loader.loaded_files.first).to eq(File.expand_path(@extension_file))
25
25
  extension = Sensu::Extension::Test.new
26
- extension.should respond_to(:name, :description, :definition, :safe_run, :stop, :has_key?, :[])
26
+ expect(extension).to respond_to(:name, :description, :definition, :safe_run, :stop, :has_key?, :[])
27
27
  end
28
28
 
29
29
  it "can attempt to load an extension with a script error" do
30
30
  script = File.join(@extension_dir, "error.rb")
31
31
  @loader.load_file(script)
32
32
  warnings = @loader.warnings
33
- warnings.size.should eq(3)
33
+ expect(warnings.size).to eq(3)
34
34
  messages = warnings.map do |warning|
35
35
  warning[:message]
36
36
  end
37
- messages.should include("loading extension file")
38
- messages.should include("ignoring extension")
39
- @loader.loaded_files.should be_empty
37
+ expect(messages).to include("loading extension file")
38
+ expect(messages).to include("ignoring extension")
39
+ expect(@loader.loaded_files).to be_empty
40
40
  end
41
41
 
42
42
  it "can load extensions from a directory" do
43
43
  @loader.load_directory(@extension_dir)
44
- @loader.warnings.size.should eq(6)
45
- @loader.loaded_files.size.should eq(2)
44
+ expect(@loader.warnings.size).to eq(6)
45
+ expect(@loader.loaded_files.size).to eq(2)
46
46
  extension = Sensu::Extension::Test.new
47
- extension.should respond_to(:name, :description, :definition, :safe_run, :stop, :has_key?, :[])
47
+ expect(extension).to respond_to(:name, :description, :definition, :safe_run, :stop, :has_key?, :[])
48
48
  extension = Sensu::Extension::MockCheck.new
49
- extension.should respond_to(:name, :description, :definition, :safe_run, :stop, :has_key?, :[])
49
+ expect(extension).to respond_to(:name, :description, :definition, :safe_run, :stop, :has_key?, :[])
50
50
  end
51
51
 
52
52
  it "can attempt to load extensions from a nonexistent directory" do
53
53
  @loader.load_directory("/tmp/bananaphone")
54
- @loader.warnings.size.should eq(1)
55
- @loader.loaded_files.should be_empty
54
+ expect(@loader.warnings.size).to eq(1)
55
+ expect(@loader.loaded_files).to be_empty
56
56
  end
57
57
 
58
58
  it "can load instances of the built-in extensions and provide accessors" do
59
59
  @loader.load_instances
60
- @loader.handler_exists?("debug").should be_true
60
+ expect(@loader.handler_exists?("debug")).to be(true)
61
61
  extension = @loader[:handlers]["debug"]
62
- extension.should be_instance_of(Sensu::Extension::Debug)
63
- extension.should respond_to(:name, :description, :definition, :safe_run, :stop, :has_key?, :[])
64
- @loader.handlers.should include(extension.definition)
65
- @loader.all.should include(extension)
66
- @loader.mutator_exists?("json").should be_true
67
- @loader.mutator_exists?("ruby_hash").should be_true
68
- @loader.mutator_exists?("only_check_output").should be_true
62
+ expect(extension).to be_instance_of(Sensu::Extension::Debug)
63
+ expect(extension).to respond_to(:name, :description, :definition, :safe_run, :stop, :has_key?, :[])
64
+ expect(@loader.handlers).to include(extension.definition)
65
+ expect(@loader.all).to include(extension)
66
+ expect(@loader.mutator_exists?("json")).to be(true)
67
+ expect(@loader.mutator_exists?("ruby_hash")).to be(true)
68
+ expect(@loader.mutator_exists?("only_check_output")).to be(true)
69
69
  end
70
70
 
71
71
  it "can load instances of the built-in and loaded extensions" do
72
72
  @loader.load_file(@extension_file)
73
73
  @loader.load_instances
74
- @loader.handler_exists?("test").should be_true
74
+ expect(@loader.handler_exists?("test")).to be(true)
75
75
  extension = @loader[:handlers]["test"]
76
- extension.should be_instance_of(Sensu::Extension::Test)
77
- extension.should respond_to(:name, :description, :definition, :safe_run, :stop, :has_key?, :[])
78
- @loader.handlers.should include(extension.definition)
79
- @loader.all.should include(extension)
80
- @loader.handler_exists?("debug").should be_true
81
- @loader.mutator_exists?("only_check_output").should be_true
76
+ expect(extension).to be_instance_of(Sensu::Extension::Test)
77
+ expect(extension).to respond_to(:name, :description, :definition, :safe_run, :stop, :has_key?, :[])
78
+ expect(@loader.handlers).to include(extension.definition)
79
+ expect(@loader.all).to include(extension)
80
+ expect(@loader.handler_exists?("debug")).to be(true)
81
+ expect(@loader.mutator_exists?("only_check_output")).to be(true)
82
82
  end
83
83
 
84
84
  it "can load specific extension categories for a sensu client" do
85
85
  @loader.load_instances("client")
86
- @loader.handler_exists?("debug").should be_false
87
- @loader.mutator_exists?("only_check_output").should be_false
88
- @loader.check_exists?("mock_check").should be_true
86
+ expect(@loader.handler_exists?("debug")).to be(false)
87
+ expect(@loader.mutator_exists?("only_check_output")).to be(false)
88
+ expect(@loader.check_exists?("mock_check")).to be(true)
89
89
  end
90
90
 
91
91
  it "can load specific extension categories for a sensu server" do
92
92
  @loader.load_instances("server")
93
- @loader.handler_exists?("debug").should be_true
94
- @loader.mutator_exists?("only_check_output").should be_true
95
- @loader.check_exists?("mock_check").should be_false
93
+ expect(@loader.handler_exists?("debug")).to be(true)
94
+ expect(@loader.mutator_exists?("only_check_output")).to be(true)
95
+ expect(@loader.check_exists?("mock_check")).to be(false)
96
96
  end
97
97
  end
@@ -17,8 +17,8 @@ describe "Sensu::Extension::Json" do
17
17
  }
18
18
  }
19
19
  @extension.safe_run(event) do |output, status|
20
- output.should eq(MultiJson.dump(event))
21
- status.should eq(0)
20
+ expect(output).to eq(MultiJson.dump(event))
21
+ expect(status).to eq(0)
22
22
  end
23
23
  end
24
24
  end
@@ -17,8 +17,8 @@ describe "Sensu::Extension::OnlyCheckOutput" do
17
17
  }
18
18
  }
19
19
  @extension.safe_run(event) do |output, status|
20
- output.should eq("foo")
21
- status.should eq(0)
20
+ expect(output).to eq("foo")
21
+ expect(status).to eq(0)
22
22
  end
23
23
  end
24
24
  end
@@ -17,8 +17,8 @@ describe "Sensu::Extension::RubyHash" do
17
17
  }
18
18
  }
19
19
  @extension.safe_run(event) do |output, status|
20
- output.should eq(event)
21
- status.should eq(0)
20
+ expect(output).to eq(event)
21
+ expect(status).to eq(0)
22
22
  end
23
23
  end
24
24
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Porter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-27 00:00:00.000000000 Z
11
+ date: 2014-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-em