Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
forked frompoise/python

Commitdc6cd4d

Browse files
committed
Merge pull requestpoise#66 from tvdinner/dev/chefspec-matchers
Add initial support for chefspec.
2 parentsdd65106 +f3720cc commitdc6cd4d

File tree

6 files changed

+64
-12
lines changed

6 files changed

+64
-12
lines changed

‎.travis.yml‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
language:ruby
2+
rvm:
3+
-1.9.3
4+
-2.0.0
5+
before_script:
6+
-bundle exec berks install
7+
-bundle exec foodcritic -f any .

‎Gemfile‎

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
source'https://rubygems.org'
22

3-
gem'rake'
4-
gem'rspec'
53
gem'foodcritic'
6-
gem'berkshelf'
7-
gem'thor-foodcritic'
8-
gem'vagrant-wrapper'
9-
10-
group:integrationdo
11-
gem'test-kitchen',:git=>"git://github.com/opscode/test-kitchen.git"
12-
gem'kitchen-vagrant',:git=>"git://github.com/opscode/kitchen-vagrant.git"
13-
gem'kitchen-ec2',:git=>"git://github.com/opscode/kitchen-ec2.git"
14-
gem'kitchen-lxc',:git=>"https://github.com/portertech/kitchen-lxc.git",:tag=>'v0.0.1.beta2'
15-
end
4+
gem'berkshelf','~> 2.0'
5+
gem'chefspec','~> 3.0'

‎Rakefile‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
require'rspec/core/rake_task'
2+
3+
RSpec::Core::RakeTask.new(:spec)
4+
5+
task:default=>:spec

‎libraries/matchers.rb‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
ifdefined?(ChefSpec)
2+
definstall_python_pip(package_name)
3+
ChefSpec::Matchers::ResourceMatcher.new(:python_pip,:install,package_name)
4+
end
5+
6+
defupgrade_python_pip(package_name)
7+
ChefSpec::Matchers::ResourceMatcher.new(:python_pip,:upgrade,package_name)
8+
end
9+
10+
defremove_python_pip(package_name)
11+
ChefSpec::Matchers::ResourceMatcher.new(:python_pip,:remove,package_name)
12+
end
13+
14+
defpurge_python_pip(package_name)
15+
ChefSpec::Matchers::ResourceMatcher.new(:python_pip,:purge,package_name)
16+
end
17+
18+
defcreate_python_virtualenv(virtualenv_name)
19+
ChefSpec::Matchers::ResourceMatcher.new(:python_virtualenv,:create,virtualenv_name)
20+
end
21+
22+
defdelete_python_virtualenv(virtualenv_name)
23+
ChefSpec::Matchers::ResourceMatcher.new(:python_virtualenv,:delete,virtualenv_name)
24+
end
25+
end

‎spec/default_spec.rb‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
require'spec_helper'
2+
3+
describe'python::default'do
4+
let:chef_rundo
5+
ChefSpec::Runner.new(platform:'ubuntu',version:'12.04').convergedescribed_recipe
6+
end
7+
8+
beforedo
9+
stub_command("/usr/bin/python -c 'import setuptools'").and_return(true)
10+
end
11+
12+
it'includes python::package by default'do
13+
expect(chef_run).toinclude_recipe('python::package')
14+
end
15+
16+
it'includes python::pip'do
17+
expect(chef_run).toinclude_recipe('python::pip')
18+
end
19+
20+
it'includes python::virtualenv'do
21+
expect(chef_run).toinclude_recipe('python::virtualenv')
22+
end
23+
end

‎spec/spec_helper.rb‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
require'chefspec'
2+
require'chefspec/berkshelf'

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp