serverspec 0.4.13 → 0.4.14

Sign up to get free protection for your applications and to get access to all the features.
@@ -128,6 +128,12 @@ module Serverspec
128
128
  cmd
129
129
  end
130
130
 
131
+ def check_installed_by_npm name, version=nil
132
+ cmd = "npm ls #{escape(name)} -g"
133
+ cmd = "#{cmd} | grep -w -- #{escape(version)}" unless version.nil?
134
+ cmd
135
+ end
136
+
131
137
  def check_belonging_group user, group
132
138
  "id #{escape(user)} | awk '{print $3}' | grep -- #{escape(group)}"
133
139
  end
@@ -1,3 +1,3 @@
1
1
  module Serverspec
2
- VERSION = "0.4.13"
2
+ VERSION = "0.4.14"
3
3
  end
@@ -43,6 +43,8 @@ describe 'Serverspec matchers of Darwin' do
43
43
 
44
44
  it_behaves_like 'support be_installed.by(gem) matcher', 'jekyll'
45
45
  it_behaves_like 'support be_installed.by(gem).with_version matcher', 'jekyll', '1.0.0'
46
+ it_behaves_like 'support be_installed.by(npm) matcher', 'bower'
47
+ it_behaves_like 'support be_installed.by(npm).with_version matcher', 'bower', '0.9.2'
46
48
 
47
49
  it_behaves_like 'support belong_to_group matcher', 'root', 'root'
48
50
  it_behaves_like 'support have_gid matcher', 'root', 0
@@ -5,4 +5,6 @@ include Serverspec::Helper::Darwin
5
5
  describe 'Serverspec package matchers of Darwin family' do
6
6
  it_behaves_like 'support package installed by gem matcher', 'jekyll'
7
7
  it_behaves_like 'support package installed by gem with version matcher', 'jekyll', '1.1.1'
8
+ it_behaves_like 'support package installed by npm matcher', 'bower'
9
+ it_behaves_like 'support package installed by npm with version matcher', 'bower', '0.9.2'
8
10
  end
@@ -43,6 +43,8 @@ describe 'Serverspec matchers of Debian family' do
43
43
 
44
44
  it_behaves_like 'support be_installed.by(gem) matcher', 'jekyll'
45
45
  it_behaves_like 'support be_installed.by(gem).with_version matcher', 'jekyll', '1.0.0'
46
+ it_behaves_like 'support be_installed.by(npm) matcher', 'bower'
47
+ it_behaves_like 'support be_installed.by(npm).with_version matcher', 'bower', '0.9.2'
46
48
 
47
49
  it_behaves_like 'support belong_to_group matcher', 'root', 'root'
48
50
  it_behaves_like 'support have_gid matcher', 'root', 0
@@ -6,4 +6,6 @@ describe 'Serverspec package matchers of Debian family' do
6
6
  it_behaves_like 'support package installed matcher', 'httpd'
7
7
  it_behaves_like 'support package installed by gem matcher', 'jekyll'
8
8
  it_behaves_like 'support package installed by gem with version matcher', 'jekyll', '1.1.1'
9
+ it_behaves_like 'support package installed by npm matcher', 'bower'
10
+ it_behaves_like 'support package installed by npm with version matcher', 'bower', '0.9.2'
9
11
  end
@@ -44,6 +44,8 @@ describe 'Serverspec matchers of Gentoo family' do
44
44
 
45
45
  it_behaves_like 'support be_installed.by(gem) matcher', 'jekyll'
46
46
  it_behaves_like 'support be_installed.by(gem).with_version matcher', 'jekyll', '1.0.0'
47
+ it_behaves_like 'support be_installed.by(npm) matcher', 'bower'
48
+ it_behaves_like 'support be_installed.by(npm).with_version matcher', 'bower', '0.9.2'
47
49
 
48
50
  it_behaves_like 'support belong_to_group matcher', 'root', 'root'
49
51
  it_behaves_like 'support have_gid matcher', 'root', 0
@@ -6,4 +6,6 @@ describe 'Serverspec package matchers of Gentoo family' do
6
6
  it_behaves_like 'support package installed matcher', 'httpd'
7
7
  it_behaves_like 'support package installed by gem matcher', 'jekyll'
8
8
  it_behaves_like 'support package installed by gem with version matcher', 'jekyll', '1.1.1'
9
+ it_behaves_like 'support package installed by npm matcher', 'bower'
10
+ it_behaves_like 'support package installed by npm with version matcher', 'bower', '0.9.2'
9
11
  end
@@ -45,6 +45,8 @@ describe 'Serverspec matchers of Red Hat family' do
45
45
 
46
46
  it_behaves_like 'support be_installed.by(gem) matcher', 'jekyll'
47
47
  it_behaves_like 'support be_installed.by(gem).with_version matcher', 'jekyll', '1.0.0'
48
+ it_behaves_like 'support be_installed.by(npm) matcher', 'bower'
49
+ it_behaves_like 'support be_installed.by(npm).with_version matcher', 'bower', '0.9.2'
48
50
 
49
51
  it_behaves_like 'support belong_to_group matcher', 'root', 'root'
50
52
  it_behaves_like 'support have_gid matcher', 'root', 0
@@ -6,4 +6,6 @@ describe 'Serverspec package matchers of Red Hat family' do
6
6
  it_behaves_like 'support package installed matcher', 'httpd'
7
7
  it_behaves_like 'support package installed by gem matcher', 'jekyll'
8
8
  it_behaves_like 'support package installed by gem with version matcher', 'jekyll', '1.1.1'
9
+ it_behaves_like 'support package installed by npm matcher', 'bower'
10
+ it_behaves_like 'support package installed by npm with version matcher', 'bower', '0.9.2'
9
11
  end
@@ -44,6 +44,8 @@ describe 'Serverspec matchers of Solaris family' do
44
44
 
45
45
  it_behaves_like 'support be_installed.by(gem) matcher', 'jekyll'
46
46
  it_behaves_like 'support be_installed.by(gem).with_version matcher', 'jekyll', '1.0.0'
47
+ it_behaves_like 'support be_installed.by(npm) matcher', 'bower'
48
+ it_behaves_like 'support be_installed.by(npm).with_version matcher', 'bower', '0.9.2'
47
49
 
48
50
  it_behaves_like 'support belong_to_group matcher', 'root', 'root'
49
51
  it_behaves_like 'support have_gid matcher', 'root', 0
@@ -6,4 +6,6 @@ describe 'Serverspec package matchers of Solaris family' do
6
6
  it_behaves_like 'support package installed matcher', 'httpd'
7
7
  it_behaves_like 'support package installed by gem matcher', 'jekyll'
8
8
  it_behaves_like 'support package installed by gem with version matcher', 'jekyll', '1.1.1'
9
+ it_behaves_like 'support package installed by npm matcher', 'bower'
10
+ it_behaves_like 'support package installed by npm with version matcher', 'bower', '0.9.2'
9
11
  end
@@ -8,6 +8,16 @@ shared_examples_for 'support command check_installed_by_gem with_version' do |pa
8
8
  it { should eq "gem list --local | grep -w -- ^#{package} | grep -w -- ^#{version}" }
9
9
  end
10
10
 
11
+ shared_examples_for 'support command check_installed_by_npm' do |package|
12
+ subject { commands.check_installed_by_npm(package) }
13
+ it { should eq "npm ls #{package} -g" }
14
+ end
15
+
16
+ shared_examples_for 'support command check_installed_by_npm with_version' do |package, version|
17
+ subject { commands.check_installed_by_npm(package) }
18
+ it { should eq "npm ls #{package} -g | grep -w -- #{version}" }
19
+ end
20
+
11
21
  shared_examples_for 'support command check_file' do |file|
12
22
  subject { commands.check_file(file) }
13
23
  it { should eq "test -f #{file}" }
@@ -653,6 +653,30 @@ shared_examples_for 'support be_installed.by(gem).with_version matcher' do |name
653
653
  end
654
654
  end
655
655
 
656
+ shared_examples_for 'support be_installed.by(npm) matcher' do |name|
657
+ describe 'be_installed.by(npm)' do
658
+ describe name do
659
+ it { should be_installed.by('npm') }
660
+ end
661
+
662
+ describe 'invalid-npm' do
663
+ it { should_not be_installed.by('npm') }
664
+ end
665
+ end
666
+ end
667
+
668
+ shared_examples_for 'support be_installed.by(npm).with_version matcher' do |name, version|
669
+ describe 'be_installed.by(npm).with_version' do
670
+ describe name do
671
+ it { should be_installed.by('npm').with_version(version) }
672
+ end
673
+
674
+ describe name do
675
+ it { should_not be_installed.by('npm').with_version('invalid-version') }
676
+ end
677
+ end
678
+ end
679
+
656
680
  shared_examples_for 'support belong_to_group matcher' do |user, group|
657
681
  describe 'belong_to_group' do
658
682
  describe user do
@@ -33,3 +33,27 @@ shared_examples_for 'support package installed by gem with version matcher' do |
33
33
  end
34
34
  end
35
35
  end
36
+
37
+ shared_examples_for 'support package installed by npm matcher' do |name|
38
+ describe 'installed by npm' do
39
+ describe package(name) do
40
+ it { should be_installed.by('npm') }
41
+ end
42
+
43
+ describe 'invalid-npm' do
44
+ it { should_not be_installed.by('npm') }
45
+ end
46
+ end
47
+ end
48
+
49
+ shared_examples_for 'support package installed by npm with version matcher' do |name, version|
50
+ describe 'installed by npm with version' do
51
+ describe package(name) do
52
+ it { should be_installed.by('npm').with_version(version) }
53
+ end
54
+
55
+ describe package(name) do
56
+ it { should_not be_installed.by('npm').with_version('invalid-version') }
57
+ end
58
+ end
59
+ 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.4.13
4
+ version: 0.4.14
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: