Skip to content

Commit 342cdcd

Browse files
committed
Updates to testing infrastructure.
1 parent 57522be commit 342cdcd

File tree

7 files changed

+17
-36
lines changed

7 files changed

+17
-36
lines changed

.travis.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
language: ruby
2-
gemfile:
3-
- test/support/Gemfile
42
rvm:
53
- 1.9.3
6-
script: BUNDLE_GEMFILE=test/support/Gemfile bundle exec rake test foodcritic
4+
bundler_args: --without integration

Gemfile

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
source "https://rubygems.org"
2+
3+
gem 'rake'
4+
gem 'minitest'
5+
gem 'foodcritic', :platforms => :ruby_19
6+
7+
# allow CI to override the version of Chef for matrix testing
8+
gem 'chef', (ENV['CHEF_VERSION'] || '>= 0.10.10')

Rakefile

+5-24
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,14 @@
11
#!/usr/bin/env rake
22
require 'rake/testtask'
3+
require 'foodcritic'
34

45
Rake::TestTask.new do |t|
5-
t.libs.push "lib"
6-
t.test_files = FileList['test/**/*_spec.rb']
6+
t.test_files = FileList['test/unit/**/*_spec.rb']
77
t.verbose = true
88
end
99

10-
desc "Runs foodcritc linter"
11-
task :foodcritic do
12-
if Gem::Version.new("1.9.2") <= Gem::Version.new(RUBY_VERSION.dup)
13-
sandbox = File.join(File.dirname(__FILE__), %w{tmp foodcritic cookbook})
14-
prepare_foodcritic_sandbox(sandbox)
15-
16-
sh "foodcritic --epic-fail any #{File.dirname(sandbox)}"
17-
else
18-
puts "WARN: foodcritic run is skipped as Ruby #{RUBY_VERSION} is < 1.9.2."
19-
end
10+
FoodCritic::Rake::LintTask.new do |t|
11+
t.options = { :fail_tags => ['any'] }
2012
end
2113

22-
task :default => 'test'
23-
24-
private
25-
26-
def prepare_foodcritic_sandbox(sandbox)
27-
files = %w{*.md *.rb attributes definitions files providers
28-
recipes resources templates}
29-
30-
rm_rf sandbox
31-
mkdir_p sandbox
32-
cp_r Dir.glob("{#{files.join(',')}}"), sandbox
33-
end
14+
task :default => [:foodcritic, :test]

test/support/Gemfile

-6
This file was deleted.

test/attributes/default_spec.rb test/unit/attributes/default_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
before do
99
@node = Chef::Node.new
1010
@node.consume_external_attrs(ohai_data, {})
11-
@node.from_file(File.join(File.dirname(__FILE__), %w{.. .. attributes default.rb}))
11+
@node.from_file(File.join(File.dirname(__FILE__), %w{.. .. .. attributes default.rb}))
1212
end
1313

1414
let(:ohai_data) do

test/providers/account_spec.rb test/unit/providers/account_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
require 'minitest/autorun'
2-
require File.expand_path(File.join(File.dirname(__FILE__), '../spec_helper'))
2+
require File.expand_path(File.join(File.dirname(__FILE__), '../../spec_helper'))
33

44
describe 'Chef::Provider::UserAccount' do
55
include ProviderMixins

test/resources/account_spec.rb test/unit/resources/account_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
require 'minitest/autorun'
2-
require File.expand_path(File.join(File.dirname(__FILE__), '../spec_helper'))
2+
require File.expand_path(File.join(File.dirname(__FILE__), '../../spec_helper'))
33

44
describe 'Chef::Resource::UserAccount' do
55
include ResourceMixins

0 commit comments

Comments
 (0)