serverspec 0.6.4 → 0.6.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -44,6 +44,10 @@ module Serverspec
44
44
  "test -f #{escape(file)}"
45
45
  end
46
46
 
47
+ def check_socket file
48
+ "test -S #{escape(file)}"
49
+ end
50
+
47
51
  def check_directory directory
48
52
  "test -d #{escape(directory)}"
49
53
  end
@@ -5,6 +5,10 @@ module Serverspec
5
5
  backend.check_file(@name)
6
6
  end
7
7
 
8
+ def socket?
9
+ backend.check_socket(@name)
10
+ end
11
+
8
12
  def directory?
9
13
  backend.check_directory(@name)
10
14
  end
@@ -1,3 +1,3 @@
1
1
  module Serverspec
2
- VERSION = "0.6.4"
2
+ VERSION = "0.6.5"
3
3
  end
@@ -5,6 +5,7 @@ include Serverspec::Helper::Darwin
5
5
  describe 'Serverspec commands of Darwin family' do
6
6
  it_behaves_like 'support command check_file', '/etc/passwd'
7
7
  it_behaves_like 'support command check_directory', '/var/log'
8
+ it_behaves_like 'support command check_socket', '/var/run/unicorn.sock'
8
9
 
9
10
  it_behaves_like 'support command check_installed_by_gem', 'jekyll'
10
11
  it_behaves_like 'support command check_installed_by_gem with_version', 'jekyll', '1.0.2'
@@ -5,6 +5,7 @@ include Serverspec::Helper::Darwin
5
5
  describe 'Serverspec file matchers of Darwin family' do
6
6
  it_behaves_like 'support file be_file matcher', '/etc/ssh/sshd_config'
7
7
  it_behaves_like 'support file be_directory matcher', '/etc/ssh'
8
+ it_behaves_like 'support file be_socket matcher', '/var/run/unicorn.sock'
8
9
  it_behaves_like 'support file contain matcher', '/etc/ssh/sshd_config', 'This is the sshd server system-wide configuration file'
9
10
  it_behaves_like 'support file contain from to matcher', 'Gemfile', 'rspec', /^group :test do/, /^end/
10
11
  it_behaves_like 'support file contain after matcher', 'Gemfile', 'rspec', /^group :test do/
@@ -5,6 +5,7 @@ include Serverspec::Helper::Debian
5
5
  describe 'Serverspec commands of Debian family' do
6
6
  it_behaves_like 'support command check_file', '/etc/passwd'
7
7
  it_behaves_like 'support command check_directory', '/var/log'
8
+ it_behaves_like 'support command check_socket', '/var/run/unicorn.sock'
8
9
 
9
10
  it_behaves_like 'support command check_installed_by_gem', 'jekyll'
10
11
  it_behaves_like 'support command check_installed_by_gem with_version', 'jekyll', '1.0.2'
@@ -5,6 +5,7 @@ include Serverspec::Helper::Debian
5
5
  describe 'Serverspec file matchers of Debian family' do
6
6
  it_behaves_like 'support file be_file matcher', '/etc/ssh/sshd_config'
7
7
  it_behaves_like 'support file be_directory matcher', '/etc/ssh'
8
+ it_behaves_like 'support file be_socket matcher', '/var/run/unicorn.sock'
8
9
  it_behaves_like 'support file contain matcher', '/etc/ssh/sshd_config', 'This is the sshd server system-wide configuration file'
9
10
  it_behaves_like 'support file contain from to matcher', 'Gemfile', 'rspec', /^group :test do/, /^end/
10
11
  it_behaves_like 'support file contain after matcher', 'Gemfile', 'rspec', /^group :test do/
@@ -5,6 +5,7 @@ include Serverspec::Helper::Gentoo
5
5
  describe 'Serverspec commands of Gentoo family' do
6
6
  it_behaves_like 'support command check_file', '/etc/passwd'
7
7
  it_behaves_like 'support command check_directory', '/var/log'
8
+ it_behaves_like 'support command check_socket', '/var/run/unicorn.sock'
8
9
 
9
10
  it_behaves_like 'support command check_installed_by_gem', 'jekyll'
10
11
  it_behaves_like 'support command check_installed_by_gem with_version', 'jekyll', '1.0.2'
@@ -5,6 +5,7 @@ include Serverspec::Helper::Gentoo
5
5
  describe 'Serverspec file matchers of Gentoo family' do
6
6
  it_behaves_like 'support file be_file matcher', '/etc/ssh/sshd_config'
7
7
  it_behaves_like 'support file be_directory matcher', '/etc/ssh'
8
+ it_behaves_like 'support file be_socket matcher', '/var/run/unicorn.sock'
8
9
  it_behaves_like 'support file contain matcher', '/etc/ssh/sshd_config', 'This is the sshd server system-wide configuration file'
9
10
  it_behaves_like 'support file contain from to matcher', 'Gemfile', 'rspec', /^group :test do/, /^end/
10
11
  it_behaves_like 'support file contain after matcher', 'Gemfile', 'rspec', /^group :test do/
@@ -5,6 +5,7 @@ include Serverspec::Helper::RedHat
5
5
  describe 'Serverspec commands of Red Hat' do
6
6
  it_behaves_like 'support command check_file', '/etc/passwd'
7
7
  it_behaves_like 'support command check_directory', '/var/log'
8
+ it_behaves_like 'support command check_socket', '/var/run/unicorn.sock'
8
9
 
9
10
  it_behaves_like 'support command check_installed_by_gem', 'jekyll'
10
11
  it_behaves_like 'support command check_installed_by_gem with_version', 'jekyll', '1.0.2'
@@ -5,6 +5,7 @@ include Serverspec::Helper::RedHat
5
5
  describe 'Serverspec file matchers of Red Hat family' do
6
6
  it_behaves_like 'support file be_file matcher', '/etc/ssh/sshd_config'
7
7
  it_behaves_like 'support file be_directory matcher', '/etc/ssh'
8
+ it_behaves_like 'support file be_socket matcher', '/var/run/unicorn.sock'
8
9
  it_behaves_like 'support file contain matcher', '/etc/ssh/sshd_config', 'This is the sshd server system-wide configuration file'
9
10
  it_behaves_like 'support file contain from to matcher', 'Gemfile', 'rspec', /^group :test do/, /^end/
10
11
  it_behaves_like 'support file contain after matcher', 'Gemfile', 'rspec', /^group :test do/
@@ -5,6 +5,7 @@ include Serverspec::Helper::Solaris
5
5
  describe 'Serverspec commands of Solaris family' do
6
6
  it_behaves_like 'support command check_file', '/etc/passwd'
7
7
  it_behaves_like 'support command check_directory', '/var/log'
8
+ it_behaves_like 'support command check_socket', '/var/run/unicorn.sock'
8
9
 
9
10
  it_behaves_like 'support command check_installed_by_gem', 'jekyll'
10
11
  it_behaves_like 'support command check_installed_by_gem with_version', 'jekyll', '1.0.2'
@@ -5,6 +5,7 @@ include Serverspec::Helper::Solaris
5
5
  describe 'Serverspec file matchers of Solaris family' do
6
6
  it_behaves_like 'support file be_file matcher', '/etc/ssh/sshd_config'
7
7
  it_behaves_like 'support file be_directory matcher', '/etc/ssh'
8
+ it_behaves_like 'support file be_socket matcher', '/var/run/unicorn.sock'
8
9
  it_behaves_like 'support file contain matcher', '/etc/ssh/sshd_config', 'This is the sshd server system-wide configuration file'
9
10
  it_behaves_like 'support file contain from to matcher', 'Gemfile', 'rspec', /^group :test do/, /^end/
10
11
  it_behaves_like 'support file contain after matcher', 'Gemfile', 'rspec', /^group :test do/
@@ -28,6 +28,11 @@ shared_examples_for 'support command check_directory' do |dir|
28
28
  it { should eq "test -d #{dir}" }
29
29
  end
30
30
 
31
+ shared_examples_for 'support command check_socket' do |socket|
32
+ subject { commands.check_socket(socket) }
33
+ it { should eq "test -S #{socket}" }
34
+ end
35
+
31
36
  shared_examples_for 'support command check_mounted' do |path|
32
37
  subject { commands.check_mounted('/') }
33
38
  it { should eq "mount | grep -w -- on\\ #{path}" }
@@ -22,6 +22,18 @@ shared_examples_for 'support file be_directory matcher' do |name|
22
22
  end
23
23
  end
24
24
 
25
+ shared_examples_for 'support file be_socket matcher' do |name|
26
+ describe 'be_socket' do
27
+ describe file(name) do
28
+ it { should be_socket }
29
+ end
30
+
31
+ describe file('/etc/invalid_socket') do
32
+ it { should_not be_socket }
33
+ end
34
+ end
35
+ end
36
+
25
37
  shared_examples_for 'support file contain matcher' do |name, pattern|
26
38
  describe 'contain' do
27
39
  describe file(name) do
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.4
4
+ version: 0.6.5
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-06-18 00:00:00.000000000 Z
12
+ date: 2013-06-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: net-ssh