serverspec 0.0.11 → 0.0.12

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.
@@ -59,6 +59,10 @@ module Serverspec
59
59
  entry_escaped = entry.gsub(/\*/, '\\*')
60
60
  "crontab -u #{user} -l | grep '#{entry_escaped}'"
61
61
  end
62
+
63
+ def check_link link, target
64
+ "stat -c %N #{link} | grep #{target}"
65
+ end
62
66
  end
63
67
  end
64
68
  end
@@ -11,3 +11,5 @@ require 'serverspec/matchers/be_mode'
11
11
  require 'serverspec/matchers/be_owned_by'
12
12
  require 'serverspec/matchers/be_grouped_into'
13
13
  require 'serverspec/matchers/have_cron_entry'
14
+ require 'serverspec/matchers/be_linked_to'
15
+
@@ -0,0 +1,6 @@
1
+ RSpec::Matchers.define :be_linked_to do |target|
2
+ match do |link|
3
+ ret = ssh_exec(RSpec.configuration.host, commands.check_link(link, target))
4
+ ret[:exit_code] == 0
5
+ end
6
+ end
@@ -1,3 +1,3 @@
1
1
  module Serverspec
2
- VERSION = "0.0.11"
2
+ VERSION = "0.0.12"
3
3
  end
@@ -23,4 +23,6 @@ describe 'Serverspec matchers of Red Hat family', :os => :redhat do
23
23
 
24
24
  it_behaves_like 'support have_cron_entry matcher', 'cron', '* * * * * /usr/bin/foo'
25
25
  it_behaves_like 'support have_cron_entry.with_user matcher', 'cron', '* * * * * /usr/bin/foo', 'root'
26
+
27
+ it behaves_like 'support be_linked_to matcher', '/etc/pam.d/system-auth', '/etc/pam.d/system-auth-ac'
26
28
  end
@@ -166,3 +166,15 @@ shared_examples_for 'support have_cron_entry.with_user matcher' do |title, entry
166
166
  end
167
167
  end
168
168
  end
169
+
170
+ shared_examples_for 'support be_linked_to matcher' do |file, target|
171
+ describe 'be_linked_to' do
172
+ describe file do
173
+ it { should be_linked_to target }
174
+ end
175
+
176
+ describe 'this-is-dummy-link' do
177
+ it { should_not be_linked_to 'dummy target' }
178
+ end
179
+ end
180
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serverspec
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 7
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 11
10
- version: 0.0.11
9
+ - 12
10
+ version: 0.0.12
11
11
  platform: ruby
12
12
  authors:
13
13
  - Gosuke Miyashita
@@ -105,6 +105,7 @@ files:
105
105
  - lib/serverspec/matchers/be_group.rb
106
106
  - lib/serverspec/matchers/be_grouped_into.rb
107
107
  - lib/serverspec/matchers/be_installed.rb
108
+ - lib/serverspec/matchers/be_linked_to.rb
108
109
  - lib/serverspec/matchers/be_listening.rb
109
110
  - lib/serverspec/matchers/be_mode.rb
110
111
  - lib/serverspec/matchers/be_owned_by.rb