Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
guilhem committed Sep 1, 2014
1 parent 391d6f5 commit 66e57b4
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 38 deletions.
5 changes: 2 additions & 3 deletions .travis.yml
@@ -1,8 +1,7 @@
language: ruby
rvm:
- 1.9.2
- 1.9.3
- 2.0.0
- 2.1.0
bundler_args: --without integration
script:
- bundle exec rake test
- bundle exec rake travis
2 changes: 1 addition & 1 deletion Berksfile
@@ -1,3 +1,3 @@
site :opscode
source 'https://supermarket.getchef.com'

metadata
19 changes: 8 additions & 11 deletions Gemfile
@@ -1,18 +1,15 @@
source 'https://rubygems.org'

group :test, :development, :integration do
gem 'rake'
gem 'chef', '>= 10.12.0'
end
gem 'rake'
gem 'berkshelf', '~> 3.1.4'
gem 'stove'

group :test, :integration do
gem 'chefspec', '~> 3.0'
gem 'foodcritic', '~> 3.0'
gem 'rubocop', '~> 0.16'
group :test do
gem 'foodcritic', '~> 4.0.0'
gem 'rubocop', '~> 0.24.1'
end

group :integration do
gem 'berkshelf', '~> 2.0'
gem 'test-kitchen', '~> 1.1'
gem 'kitchen-vagrant', '~> 0.14'
gem 'test-kitchen', '~> 1.2.1'
gem 'kitchen-vagrant', '~> 0.15.0'
end
60 changes: 37 additions & 23 deletions Rakefile
@@ -1,37 +1,51 @@
#!/usr/bin/env rake

require 'bundler/setup'

# Style tests. Rubocop and Foodcritic
namespace :style do
require 'rubocop/rake_task'
desc 'Run Ruby style checks'
Rubocop::RakeTask.new(:ruby)
begin
require 'rubocop/rake_task'
desc 'Run Ruby style checks'
RuboCop::RakeTask.new(:ruby)
rescue LoadError
puts '>>>>> Rubocop gem not loaded, omitting tasks' unless ENV['CI']
end

require 'foodcritic'
desc 'Run Chef style checks'
FoodCritic::Rake::LintTask.new(:chef)
begin
require 'foodcritic'

desc 'Run Chef style checks'
FoodCritic::Rake::LintTask.new(:chef) do |t|
t.options = {
fail_tags: ['any']
}
end
rescue LoadError
puts '>>>>> foodcritic gem not loaded, omitting tasks' unless ENV['CI']
end
end

desc 'Run all style checks'
task style: ['style:chef', 'style:ruby']

require 'rspec/core/rake_task'
desc 'Run ChefSpec unit tests'
RSpec::Core::RakeTask.new(:unit) do |t|
t.rspec_opts = '--color --format progress'
end
# Integration tests. Kitchen.ci
namespace :integration do
begin
require 'kitchen/rake_tasks'

require 'kitchen'
desc 'Run Test Kitchen integration tests'
task :integration do
Kitchen.logger = Kitchen.default_file_logger
Kitchen::Config.new.instances.each do |instance|
instance.test(:always)
desc 'Run kitchen integration tests'
Kitchen::RakeTasks.new
rescue LoadError
puts '>>>>> Kitchen gem not loaded, omitting tasks' unless ENV['CI']
end
end

# The default rake task should just run it all
task default: %w(style unit integration)
namespace :maintain do
require 'stove/rake_task'
Stove::RakeTask.new
end

desc 'Run all tests on Travis'
task travis: ['style']

# Test task is for Travis, no integration tests
task test: %w(style unit)
# Default
task default: ['style', 'integration:kitchen:all']

0 comments on commit 66e57b4

Please sign in to comment.