Skip to content

Instantly share code, notes, and snippets.

@ikuwow
Last active August 29, 2015 14:14
Show Gist options
  • Select an option

  • Save ikuwow/3c39ec8048e99c502b00 to your computer and use it in GitHub Desktop.

Select an option

Save ikuwow/3c39ec8048e99c502b00 to your computer and use it in GitHub Desktop.
serverspecのpackageリソースはrpmコマンドでテストをする ref: http://qiita.com/ikuwow/items/27b99b6540ee48afa988
$ tree spec/
spec/
├── default
│   └── sample_spec.rb
└── spec_helper.rb
Failures:
1) Package "vim" should be installed
On host `default'
Failure/Error: it { should be_installed }
expected Package "vim" to be installed
sudo -p 'Password: ' /bin/sh -c rpm\ -q\ vim
package vim is not installed
# ./spec/default/sample_spec.rb:4:in `block (2 levels) in <top (required)>'
$ rpm -qa | grep vim
vim-common-7.2.411-1.8.el6.x86_64
vim-enhanced-7.2.411-1.8.el6.x86_64
vim-minimal-7.2.411-1.8.el6.x86_64
Package "vim-common"
should be installed
Package "vim-enhanced"
should be installed
Package "vim-minimal"
should be installed
Finished in 0.69752 seconds (files took 6.01 seconds to load)
3 examples, 0 failures
require 'spec_helper'
%w{vim-common vim-enhanced vim-minimal}.each do |vim|
describe package(vim) do
it { should be_installed }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment