serverspec 0.6.22 → 0.6.23

Sign up to get free protection for your applications and to get access to all the features.
@@ -25,6 +25,8 @@ module Serverspec
25
25
  end
26
26
  cmd
27
27
  end
28
+
29
+ alias :check_installed_by_rpm :check_installed
28
30
  end
29
31
  end
30
32
  end
@@ -1,3 +1,3 @@
1
1
  module Serverspec
2
- VERSION = "0.6.22"
2
+ VERSION = "0.6.23"
3
3
  end
@@ -13,7 +13,6 @@ describe 'Serverspec commands of Darwin family' do
13
13
  it_behaves_like 'support command check_belonging_group', 'root', 'wheel'
14
14
 
15
15
  it_behaves_like 'support command check_uid', 'root', 0
16
- it_behaves_like 'support command check_gid', 'root', 0
17
16
 
18
17
  it_behaves_like 'support command check_login_shell', 'root', '/bin/bash'
19
18
  it_behaves_like 'support command check_home_directory', 'root', '/root'
@@ -2,7 +2,20 @@ require 'spec_helper'
2
2
 
3
3
  include Serverspec::Helper::Darwin
4
4
 
5
- describe 'Serverspec user matchers of Darwin family' do
6
- it_behaves_like 'support group exist matcher', 'root'
7
- it_behaves_like 'support group have_gid matcher', 'root', 0
5
+ describe group('root') do
6
+ it { should exist }
7
+ its(:command) { should eq "getent group | grep -wq -- root" }
8
+ end
9
+
10
+ describe group('invalid-group') do
11
+ it { should_not exist }
12
+ end
13
+
14
+ describe group('root') do
15
+ it { should have_gid 0 }
16
+ its(:command) { should eq "getent group | grep -w -- \\^root | cut -f 3 -d ':' | grep -w -- 0" }
17
+ end
18
+
19
+ describe group('root') do
20
+ it { should_not have_gid 'invalid-gid' }
8
21
  end
@@ -17,7 +17,6 @@ describe 'Serverspec commands of Debian family' do
17
17
  it_behaves_like 'support command check_belonging_group', 'root', 'wheel'
18
18
 
19
19
  it_behaves_like 'support command check_uid', 'root', 0
20
- it_behaves_like 'support command check_gid', 'root', 0
21
20
 
22
21
  it_behaves_like 'support command check_login_shell', 'root', '/bin/bash'
23
22
  it_behaves_like 'support command check_home_directory', 'root', '/root'
@@ -2,7 +2,21 @@ require 'spec_helper'
2
2
 
3
3
  include Serverspec::Helper::Debian
4
4
 
5
- describe 'Serverspec user matchers of Debian family' do
6
- it_behaves_like 'support group exist matcher', 'root'
7
- it_behaves_like 'support group have_gid matcher', 'root', 0
5
+ describe group('root') do
6
+ it { should exist }
7
+ its(:command) { should eq "getent group | grep -wq -- root" }
8
8
  end
9
+
10
+ describe group('invalid-group') do
11
+ it { should_not exist }
12
+ end
13
+
14
+ describe group('root') do
15
+ it { should have_gid 0 }
16
+ its(:command) { should eq "getent group | grep -w -- \\^root | cut -f 3 -d ':' | grep -w -- 0" }
17
+ end
18
+
19
+ describe group('root') do
20
+ it { should_not have_gid 'invalid-gid' }
21
+ end
22
+
@@ -13,7 +13,6 @@ describe 'Serverspec commands of Gentoo family' do
13
13
  it_behaves_like 'support command check_belonging_group', 'root', 'wheel'
14
14
 
15
15
  it_behaves_like 'support command check_uid', 'root', 0
16
- it_behaves_like 'support command check_gid', 'root', 0
17
16
 
18
17
  it_behaves_like 'support command check_login_shell', 'root', '/bin/bash'
19
18
  it_behaves_like 'support command check_home_directory', 'root', '/root'
@@ -2,7 +2,20 @@ require 'spec_helper'
2
2
 
3
3
  include Serverspec::Helper::Gentoo
4
4
 
5
- describe 'Serverspec user matchers of Gentoo family' do
6
- it_behaves_like 'support group exist matcher', 'root'
7
- it_behaves_like 'support group have_gid matcher', 'root', 0
5
+ describe group('root') do
6
+ it { should exist }
7
+ its(:command) { should eq "getent group | grep -wq -- root" }
8
+ end
9
+
10
+ describe group('invalid-group') do
11
+ it { should_not exist }
12
+ end
13
+
14
+ describe group('root') do
15
+ it { should have_gid 0 }
16
+ its(:command) { should eq "getent group | grep -w -- \\^root | cut -f 3 -d ':' | grep -w -- 0" }
17
+ end
18
+
19
+ describe group('root') do
20
+ it { should_not have_gid 'invalid-gid' }
8
21
  end
@@ -17,7 +17,6 @@ describe 'Serverspec commands of Red Hat' do
17
17
  it_behaves_like 'support command check_belonging_group', 'root', 'wheel'
18
18
 
19
19
  it_behaves_like 'support command check_uid', 'root', 0
20
- it_behaves_like 'support command check_gid', 'root', 0
21
20
 
22
21
  it_behaves_like 'support command check_login_shell', 'root', '/bin/bash'
23
22
  it_behaves_like 'support command check_home_directory', 'root', '/root'
@@ -2,7 +2,20 @@ require 'spec_helper'
2
2
 
3
3
  include Serverspec::Helper::RedHat
4
4
 
5
- describe 'Serverspec user matchers of Red Hat family' do
6
- it_behaves_like 'support group exist matcher', 'root'
7
- it_behaves_like 'support group have_gid matcher', 'root', 0
5
+ describe group('root') do
6
+ it { should exist }
7
+ its(:command) { should eq "getent group | grep -wq -- root" }
8
+ end
9
+
10
+ describe group('invalid-group') do
11
+ it { should_not exist }
12
+ end
13
+
14
+ describe group('root') do
15
+ it { should have_gid 0 }
16
+ its(:command) { should eq "getent group | grep -w -- \\^root | cut -f 3 -d ':' | grep -w -- 0" }
17
+ end
18
+
19
+ describe group('root') do
20
+ it { should_not have_gid 'invalid-gid' }
8
21
  end
@@ -11,11 +11,20 @@ describe package('invalid-package') do
11
11
  it { should_not be_installed }
12
12
  end
13
13
 
14
+ package('invalid-package') do
15
+ it { should_not be_installed.by('rpm') }
16
+ end
17
+
14
18
  describe package('httpd') do
15
19
  it { should be_installed.with_version('2.2.15-28.el6') }
16
20
  its(:command) { should eq "rpm -q httpd | grep -w -- 2.2.15-28.el6" }
17
21
  end
18
22
 
23
+ describe package('httpd') do
24
+ it { should be_installed.by('rpm').with_version('2.2.15-28.el6') }
25
+ its(:command) { should eq "rpm -q httpd | grep -w -- 2.2.15-28.el6" }
26
+ end
27
+
19
28
  describe package('httpd') do
20
29
  it { should_not be_installed.with_version('invalid-version') }
21
30
  end
@@ -49,11 +49,6 @@ describe 'check_belonging_group' do
49
49
  it { should eq "id -Gn root | grep -- wheel" }
50
50
  end
51
51
 
52
- describe 'check_gid' do
53
- subject { commands.check_gid('root', 0) }
54
- it { should eq "getent group | grep -- \\^root: | cut -f 3 -d ':' | grep -w -- 0" }
55
- end
56
-
57
52
  describe 'check_zfs' do
58
53
  context 'check without properties' do
59
54
  subject { commands.check_zfs('rpool') }
@@ -49,11 +49,6 @@ describe 'check_belonging_group' do
49
49
  it { should eq "id -Gn root | grep -- wheel" }
50
50
  end
51
51
 
52
- describe 'check_gid' do
53
- subject { commands.check_gid('root', 0) }
54
- it { should eq "getent group | grep -- \\^root: | cut -f 3 -d ':' | grep -w -- 0" }
55
- end
56
-
57
52
  describe 'check_zfs' do
58
53
  context 'check without properties' do
59
54
  subject { commands.check_zfs('rpool') }
@@ -2,7 +2,20 @@ require 'spec_helper'
2
2
 
3
3
  include Serverspec::Helper::Solaris
4
4
 
5
- describe 'Serverspec user matchers of Solaris family' do
6
- it_behaves_like 'support group exist matcher', 'root'
7
- it_behaves_like 'support group have_gid matcher', 'root', 0
5
+ describe group('root') do
6
+ it { should exist }
7
+ its(:command) { should eq "getent group | grep -wq -- root" }
8
+ end
9
+
10
+ describe group('invalid-group') do
11
+ it { should_not exist }
12
+ end
13
+
14
+ describe group('root') do
15
+ it { should have_gid 0 }
16
+ its(:command) { should eq "getent group | grep -- \\^root: | cut -f 3 -d ':' | grep -w -- 0" }
17
+ end
18
+
19
+ describe group('root') do
20
+ it { should_not have_gid 'invalid-gid' }
8
21
  end
@@ -33,11 +33,6 @@ describe 'check_belonging_group' do
33
33
  it { should eq "id -Gn root | grep -- wheel" }
34
34
  end
35
35
 
36
- describe 'check_gid' do
37
- subject { commands.check_gid('root', 0) }
38
- it { should eq "getent group | grep -- \\^root: | cut -f 3 -d ':' | grep -w -- 0" }
39
- end
40
-
41
36
  describe 'check_zfs' do
42
37
  context 'check without properties' do
43
38
  subject { commands.check_zfs('rpool') }
@@ -34,11 +34,6 @@ describe 'check_belonging_group' do
34
34
  it { should eq "id -Gn root | grep -- wheel" }
35
35
  end
36
36
 
37
- describe 'check_gid' do
38
- subject { commands.check_gid('root', 0) }
39
- it { should eq "getent group | grep -- \\^root: | cut -f 3 -d ':' | grep -w -- 0" }
40
- end
41
-
42
37
  describe 'check_zfs' do
43
38
  context 'check without properties' do
44
39
  subject { commands.check_zfs('rpool') }
@@ -2,7 +2,20 @@ require 'spec_helper'
2
2
 
3
3
  include Serverspec::Helper::Solaris11
4
4
 
5
- describe 'Serverspec user matchers of Solaris11 family' do
6
- it_behaves_like 'support group exist matcher', 'root'
7
- it_behaves_like 'support group have_gid matcher', 'root', 0
5
+ describe group('root') do
6
+ it { should exist }
7
+ its(:command) { should eq "getent group | grep -wq -- root" }
8
+ end
9
+
10
+ describe group('invalid-group') do
11
+ it { should_not exist }
12
+ end
13
+
14
+ describe group('root') do
15
+ it { should have_gid 0 }
16
+ its(:command) { should eq "getent group | grep -- \\^root: | cut -f 3 -d ':' | grep -w -- 0" }
17
+ end
18
+
19
+ describe group('root') do
20
+ it { should_not have_gid 'invalid-gid' }
8
21
  end
@@ -3,10 +3,6 @@ shared_examples_for 'support command check_user' do |user|
3
3
  it { should eq "id #{user}" }
4
4
  end
5
5
 
6
- shared_examples_for 'support command check_group' do |group|
7
- subject { commands.check_group(group) }
8
- it { should eq "getent group | grep -wq -- #{group}" }
9
- end
10
6
  shared_examples_for 'support command check_running_under_supervisor' do |service|
11
7
  subject { commands.check_running_under_supervisor(service) }
12
8
  it { should eq "supervisorctl status #{service}" }
@@ -38,11 +34,6 @@ shared_examples_for 'support command check_uid' do |user, uid|
38
34
  it { should eq "id #{user} | grep -- \\^uid\\=#{uid}\\(" }
39
35
  end
40
36
 
41
- shared_examples_for 'support command check_gid' do |group, gid|
42
- subject { commands.check_gid('root', 0) }
43
- it { should eq "getent group | grep -w -- \\^#{group} | cut -f 3 -d ':' | grep -w -- #{gid}" }
44
- end
45
-
46
37
  shared_examples_for 'support command check_login_shell' do |user, shell|
47
38
  subject { commands.check_login_shell(user, shell) }
48
39
  it { should eq "getent passwd #{user} | cut -f 7 -d ':' | grep -w -- #{shell}" }
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.6.22
4
+ version: 0.6.23
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -319,9 +319,8 @@ files:
319
319
  - spec/solaris11/zfs_spec.rb
320
320
  - spec/spec_helper.rb
321
321
  - spec/support/shared_commands_examples.rb
322
- - spec/support/shared_group_examples.rb
323
322
  - spec/support/shared_service_examples.rb
324
- - spec/support/shared_user_examples.rb
323
+ - spec/support/shared_uer_examples.rb
325
324
  homepage: http://serverspec.org/
326
325
  licenses:
327
326
  - MIT
@@ -343,7 +342,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
343
342
  version: '0'
344
343
  requirements: []
345
344
  rubyforge_project:
346
- rubygems_version: 1.8.23
345
+ rubygems_version: 1.8.25
347
346
  signing_key:
348
347
  specification_version: 3
349
348
  summary: RSpec tests for your servers configured by Puppet, Chef or anything else
@@ -451,6 +450,5 @@ test_files:
451
450
  - spec/solaris11/zfs_spec.rb
452
451
  - spec/spec_helper.rb
453
452
  - spec/support/shared_commands_examples.rb
454
- - spec/support/shared_group_examples.rb
455
453
  - spec/support/shared_service_examples.rb
456
- - spec/support/shared_user_examples.rb
454
+ - spec/support/shared_uer_examples.rb
@@ -1,23 +0,0 @@
1
- shared_examples_for 'support group exist matcher' do |name|
2
- describe 'group exist' do
3
- describe group(name) do
4
- it { should exist }
5
- end
6
-
7
- describe group('invalid-group') do
8
- it { should_not exist }
9
- end
10
- end
11
- end
12
-
13
- shared_examples_for 'support group have_gid matcher' do |name, gid|
14
- describe 'have_gid' do
15
- describe group(name) do
16
- it { should have_gid gid }
17
- end
18
-
19
- describe group(name) do
20
- it { should_not have_gid 'invalid-gid' }
21
- end
22
- end
23
- end