diff --git a/Rakefile b/Rakefile index 6b53b716..dbe89556 100644 --- a/Rakefile +++ b/Rakefile @@ -1,12 +1,20 @@ require 'rspec/core/rake_task' namespace :spec do + def test_pattern(test_type) + specfile = ENV['S'].to_s.strip.length > 0 ? "*#{ENV['S']}*" : '*' + pattern = "spec/#{test_type}/**/#{specfile}_spec.rb" + puts pattern + + Dir[pattern] + end + RSpec::Core::RakeTask.new(:unit) do |t| t.rspec_opts = "--color --format documentation" - t.pattern = Dir['spec/unit/**/*_spec.rb'] + t.pattern = test_pattern('unit') end RSpec::Core::RakeTask.new(:integration) do |t| - t.pattern = Dir['spec/integration/**/*_spec.rb'] + t.pattern = test_pattern('integration') end end diff --git a/run_tests.sh b/run_tests.sh index d8ec6714..b4393c32 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -31,8 +31,8 @@ function ruby_checks() { bundle install # Run unit rspec tests - bundle exec rake spec:unit + bundle exec rake spec:unit S=$1 } license_check -ruby_checks +ruby_checks $@