diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2014-11-14 11:26:27 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2014-11-14 11:26:27 -0800 |
commit | 8d0aeb1716bda762cf6506d8a8f3e570cde600b2 (patch) | |
tree | e6613a02e03900ac3c529b3d157842c257624c1d | |
parent | 88a210b46a02aa82f8bf80fab7091b23da7720a3 (diff) | |
parent | 70e7e2a56d8b6db36de331df53e9be46252b9fc3 (diff) | |
download | chef-8d0aeb1716bda762cf6506d8a8f3e570cde600b2.tar.gz |
Merge pull request #2421 from opscode/lcg/faster-rspec
skip expensive spec tests by default
-rw-r--r-- | .travis.yml | 10 | ||||
-rw-r--r-- | tasks/rspec.rb | 34 |
2 files changed, 25 insertions, 19 deletions
diff --git a/.travis.yml b/.travis.yml index 7e539fd70f..b2b002d8b7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,15 @@ branches: - 11-stable - 12-stable -script: bundle exec rspec --color --format progress +# do not run expensive spec tests on PRs, only on branches +script: " +echo '--color\n-fp' > .rspec; +if [ ${TRAVIS_PULL_REQUEST} = 'false' ]; +then + bundle exec rake spec:all; +else + bundle exec rake spec; +fi" env: global: diff --git a/tasks/rspec.rb b/tasks/rspec.rb index 95ae274955..a6fc5a9180 100644 --- a/tasks/rspec.rb +++ b/tasks/rspec.rb @@ -27,28 +27,16 @@ begin task :default => :spec - desc "Run all specs in spec directory" + desc "Run standard specs (minus long running specs)" RSpec::Core::RakeTask.new(:spec) do |t| - t.rspec_opts = ['--options', "\"#{CHEF_ROOT}/.rspec\""] - t.pattern = FileList['spec/**/*_spec.rb'] - end - - desc "Run all functional specs (in functional/ directory)" - RSpec::Core::RakeTask.new(:functional) do |t| - t.rspec_opts = ['--options', "\"#{CHEF_ROOT}/spec/spec.opts\""] - t.pattern = FileList['spec/functional/**/*_spec.rb'] - end - - desc "Run the rspec tests with activesupport loaded" - RSpec::Core::RakeTask.new(:spec_activesupport) do |t| - t.rspec_opts = ['--options', "\"#{CHEF_ROOT}/.rspec\"", "--require active_support/core_ext"] - t.pattern = FileList['spec/unit/**/*_spec.rb'] + # right now this just limits to functional + unit, but could also remove + # individual tests marked long-running + t.pattern = FileList['spec/{functional,unit}/**/*_spec.rb'] end namespace :spec do desc "Run all specs in spec directory with RCov" RSpec::Core::RakeTask.new(:rcov) do |t| - t.rspec_opts = ['--options', "\"#{CHEF_ROOT}/spec/spec.opts\""] t.pattern = FileList['spec/**/*_spec.rb'] t.rcov = true t.rcov_opts = lambda do @@ -56,16 +44,26 @@ begin end end + desc "Run all specs in spec directory" + RSpec::Core::RakeTask.new(:all) do |t| + t.pattern = FileList['spec/**/*_spec.rb'] + end + desc "Print Specdoc for all specs" RSpec::Core::RakeTask.new(:doc) do |t| t.rspec_opts = ["--format", "specdoc", "--dry-run"] t.pattern = FileList['spec/**/*_spec.rb'] end - [:unit].each do |sub| + desc "Run the specs under spec/unit with activesupport loaded" + RSpec::Core::RakeTask.new(:activesupport) do |t| + t.rspec_opts = ["--require active_support/core_ext"] + t.pattern = FileList['spec/unit/**/*_spec.rb'] + end + + [:unit, :functional, :integration, :stress].each do |sub| desc "Run the specs under spec/#{sub}" RSpec::Core::RakeTask.new(sub) do |t| - t.rspec_opts = ['--options', "\"#{CHEF_ROOT}/spec/spec.opts\""] t.pattern = FileList["spec/#{sub}/**/*_spec.rb"] end end |