rspec-system-serverspec 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,17 @@
1
+ rspec-system-puppet - Puppet rspec-system plugin
2
+
3
+ Copyright (C) 2013 Puppet Labs Inc
4
+
5
+ Puppet Labs can be contacted at: info@puppetlabs.com
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,16 @@
1
+ # rspec-system-serverspec
2
+
3
+ `rspec-system-serverspec` is a [Serverspec](http://serverspec.org/) plugin for [rspec-system](https://rubygems.org/gems/rspec-system). The purpose is to provide the ability to use Serverspec matchers in rspec-system tests.
4
+
5
+ ## Quick Start
6
+
7
+ * Have a module that is configured to use rspec-system
8
+ * `gem install serverspec`
9
+ * Add the `serverspec` and `rspec-system-serverspec` gems to your module's `Gemfile`
10
+ * Add these lines to your `spec/spec_helper_system.rb` file:
11
+
12
+ ```ruby
13
+ require 'rspec-system-serverspec/helpers'
14
+ include Serverspec::Helper::RSpecSystem
15
+ include Serverspec::Helper::DetectOS
16
+ ```
File without changes
@@ -0,0 +1,29 @@
1
+ require 'serverspec/backend/exec'
2
+
3
+ module Serverspec
4
+ module Backend
5
+ class RSpecSystem < Serverspec::Backend::Exec
6
+ def run_command(cmd, opt={})
7
+ cmd = build_command(cmd)
8
+ cmd = add_pre_command(cmd)
9
+ ret = ssh_exec!(cmd)
10
+
11
+ if @example
12
+ @example.metadata[:command] = cmd
13
+ @example.metadata[:stdout] = ret[:stdout]
14
+ end
15
+
16
+ ret
17
+ end
18
+
19
+ private
20
+ def ssh_exec!(command)
21
+ ::RSpecSystem::Helpers.shell(command).to_hash.inject({}) do |h,(k,v)|
22
+ k = :exit_status if k == :exit_code
23
+ h[k] = v
24
+ h
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,14 @@
1
+ module Serverspec
2
+ module Helper
3
+ module RSpecSystem
4
+ def backend(commands_object=nil)
5
+ if ! respond_to?(:commands)
6
+ commands_object = Serverspec::Commands::Base.new
7
+ end
8
+ instance = Serverspec::Backend::RSpecSystem.instance
9
+ instance.set_commands(commands_object || commands)
10
+ instance
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,4 @@
1
+ require 'serverspec'
2
+ require 'rspec-system'
3
+ require 'rspec-system-serverspec/backend/rspec_system'
4
+ require 'rspec-system-serverspec/helper/rspec_system'
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ Gem::Specification.new do |s|
3
+ # Metadata
4
+ s.name = 'rspec-system-serverspec'
5
+ s.version = '1.0.0'
6
+ s.authors = ['Hunter Haugen']
7
+ s.email = ['h.haugen@gmail.com']
8
+ s.summary = 'Serverspec rspec-system plugin'
9
+ s.description = 'Integration plugin for combining the Serverspec testing library with rspec-system'
10
+ s.homepage = 'https://github.com/puppetlabs/rspec-system-serverspec'
11
+ s.license = 'Apache2'
12
+
13
+ # Manifest
14
+ s.files = `git ls-files`.split($/)
15
+ s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
16
+ s.test_files = s.files.grep(%r{^(test|spec|features)/.+_spec\.rb})
17
+ s.require_paths = ['lib']
18
+
19
+ # Dependencies
20
+ s.required_ruby_version = '>= 1.8.7'
21
+ s.add_runtime_dependency 'rspec-system', '~> 2.0'
22
+ s.add_runtime_dependency 'serverspec', '~> 0.6.0'
23
+ s.add_development_dependency "bundler", "~> 1.3"
24
+ s.add_development_dependency "rake"
25
+ end
metadata ADDED
@@ -0,0 +1,120 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rspec-system-serverspec
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Hunter Haugen
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-07-08 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec-system
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '2.0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '2.0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: serverspec
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 0.6.0
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 0.6.0
46
+ - !ruby/object:Gem::Dependency
47
+ name: bundler
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '1.3'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '1.3'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rake
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ description: Integration plugin for combining the Serverspec testing library with
79
+ rspec-system
80
+ email:
81
+ - h.haugen@gmail.com
82
+ executables: []
83
+ extensions: []
84
+ extra_rdoc_files: []
85
+ files:
86
+ - Gemfile
87
+ - LICENSE
88
+ - README.md
89
+ - lib/rspec-system-serverspec.rb
90
+ - lib/rspec-system-serverspec/backend/rspec_system.rb
91
+ - lib/rspec-system-serverspec/helper/rspec_system.rb
92
+ - lib/rspec-system-serverspec/helpers.rb
93
+ - rspec-system-serverspec.gemspec
94
+ homepage: https://github.com/puppetlabs/rspec-system-serverspec
95
+ licenses:
96
+ - Apache2
97
+ post_install_message:
98
+ rdoc_options: []
99
+ require_paths:
100
+ - lib
101
+ required_ruby_version: !ruby/object:Gem::Requirement
102
+ none: false
103
+ requirements:
104
+ - - ! '>='
105
+ - !ruby/object:Gem::Version
106
+ version: 1.8.7
107
+ required_rubygems_version: !ruby/object:Gem::Requirement
108
+ none: false
109
+ requirements:
110
+ - - ! '>='
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ requirements: []
114
+ rubyforge_project:
115
+ rubygems_version: 1.8.23
116
+ signing_key:
117
+ specification_version: 3
118
+ summary: Serverspec rspec-system plugin
119
+ test_files: []
120
+ has_rdoc: