serverspec 0.1.0 → 0.1.1

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.
@@ -0,0 +1,6 @@
1
+ RSpec::Matchers.define :get_stdout do |expected|
2
+ match do |command|
3
+ ret = ssh_exec(command)
4
+ ret[:stdout] =~ /#{expected}/
5
+ end
6
+ end
@@ -15,3 +15,4 @@ require 'serverspec/matchers/be_linked_to'
15
15
  require 'serverspec/matchers/be_installed_by_gem'
16
16
  require 'serverspec/matchers/belong_to_group'
17
17
  require 'serverspec/matchers/have_iptables_rule'
18
+ require 'serverspec/matchers/get_stdout'
@@ -1,3 +1,3 @@
1
1
  module Serverspec
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -31,4 +31,5 @@ describe 'Serverspec matchers of Debian family', :os => :debian do
31
31
  it_behaves_like 'support have_iptables_rule matcher', '-P INPUT ACCEPT'
32
32
  it_behaves_like 'support have_iptables_rule.with_table.with_chain matcher', '-P INPUT ACCEPT', 'mangle', 'INPUT'
33
33
 
34
+ it_behaves_like 'support get_stdout matcher', 'whoami', 'root'
34
35
  end
@@ -32,4 +32,5 @@ describe 'Serverspec matchers of Gentoo family', :os => :gentoo do
32
32
  it_behaves_like 'support have_iptables_rule matcher', '-P INPUT ACCEPT'
33
33
  it_behaves_like 'support have_iptables_rule.with_table.with_chain matcher', '-P INPUT ACCEPT', 'mangle', 'INPUT'
34
34
 
35
+ it_behaves_like 'support get_stdout matcher', 'whoami', 'root'
35
36
  end
@@ -31,4 +31,6 @@ describe 'Serverspec matchers of Red Hat family', :os => :redhat do
31
31
 
32
32
  it_behaves_like 'support have_iptables_rule matcher', '-P INPUT ACCEPT'
33
33
  it_behaves_like 'support have_iptables_rule.with_table.with_chain matcher', '-P INPUT ACCEPT', 'mangle', 'INPUT'
34
+
35
+ it_behaves_like 'support get_stdout matcher', 'whoami', 'root'
34
36
  end
@@ -29,4 +29,5 @@ describe 'Serverspec matchers of Solaris family', :os => :solaris do
29
29
 
30
30
  it_behaves_like 'support belong_to_group matcher', 'root', 'root'
31
31
 
32
+ it_behaves_like 'support get_stdout matcher', 'whoami', 'root'
32
33
  end
@@ -244,3 +244,19 @@ shared_examples_for 'support have_iptables_rule.with_table.with_chain matcher' d
244
244
  end
245
245
  end
246
246
  end
247
+
248
+ shared_examples_for 'support get_stdout matcher' do |command, output|
249
+ before :all do
250
+ RSpec.configure do |c|
251
+ c.stdout = "#{output}\r\n"
252
+ end
253
+ end
254
+
255
+ describe command do
256
+ it { should get_stdout output }
257
+ end
258
+
259
+ describe command do
260
+ it { should_not get_stdout 'invalid-output' }
261
+ end
262
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serverspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-31 00:00:00.000000000 Z
12
+ date: 2013-04-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: net-ssh
@@ -114,6 +114,7 @@ files:
114
114
  - lib/serverspec/matchers/be_user.rb
115
115
  - lib/serverspec/matchers/belong_to_group.rb
116
116
  - lib/serverspec/matchers/contain.rb
117
+ - lib/serverspec/matchers/get_stdout.rb
117
118
  - lib/serverspec/matchers/have_cron_entry.rb
118
119
  - lib/serverspec/matchers/have_iptables_rule.rb
119
120
  - lib/serverspec/setup.rb