diff options
Diffstat (limited to 'vendor/plugins/thinking-sphinx/tasks/testing.rb')
| -rw-r--r-- | vendor/plugins/thinking-sphinx/tasks/testing.rb | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/vendor/plugins/thinking-sphinx/tasks/testing.rb b/vendor/plugins/thinking-sphinx/tasks/testing.rb new file mode 100644 index 0000000..9cb83ba --- /dev/null +++ b/vendor/plugins/thinking-sphinx/tasks/testing.rb | |||
| @@ -0,0 +1,86 @@ | |||
| 1 | require 'rubygems' | ||
| 2 | require 'spec/rake/spectask' | ||
| 3 | require 'cucumber/rake/task' | ||
| 4 | |||
| 5 | desc "Run the specs under spec" | ||
| 6 | Spec::Rake::SpecTask.new do |t| | ||
| 7 | t.spec_files = FileList['spec/**/*_spec.rb'] | ||
| 8 | t.spec_opts << "-c" | ||
| 9 | end | ||
| 10 | |||
| 11 | desc "Run all feature-set configurations" | ||
| 12 | task :features do |t| | ||
| 13 | puts "rake features:mysql" | ||
| 14 | system "rake features:mysql" | ||
| 15 | puts "rake features:postgresql" | ||
| 16 | system "rake features:postgresql" | ||
| 17 | end | ||
| 18 | |||
| 19 | namespace :features do | ||
| 20 | def add_task(name, description) | ||
| 21 | Cucumber::Rake::Task.new(name, description) do |t| | ||
| 22 | t.cucumber_opts = "--format pretty" | ||
| 23 | t.step_pattern = [ | ||
| 24 | "features/support/env", | ||
| 25 | "features/support/db/#{name}", | ||
| 26 | "features/support/db/active_record", | ||
| 27 | "features/support/post_database", | ||
| 28 | "features/step_definitions/**.rb" | ||
| 29 | ] | ||
| 30 | end | ||
| 31 | end | ||
| 32 | |||
| 33 | add_task :mysql, "Run feature-set against MySQL" | ||
| 34 | add_task :postgresql, "Run feature-set against PostgreSQL" | ||
| 35 | end | ||
| 36 | |||
| 37 | desc "Generate RCov reports" | ||
| 38 | Spec::Rake::SpecTask.new(:rcov) do |t| | ||
| 39 | t.libs << 'lib' | ||
| 40 | t.spec_files = FileList['spec/**/*_spec.rb'] | ||
| 41 | t.rcov = true | ||
| 42 | t.rcov_opts = ['--exclude', 'spec', '--exclude', 'gems', '--exclude', 'riddle'] | ||
| 43 | end | ||
| 44 | |||
| 45 | namespace :rcov do | ||
| 46 | def add_task(name, description) | ||
| 47 | Cucumber::Rake::Task.new(name, description) do |t| | ||
| 48 | t.cucumber_opts = "--format pretty" | ||
| 49 | t.step_pattern = [ | ||
| 50 | "features/support/env", | ||
| 51 | "features/support/db/#{name}", | ||
| 52 | "features/support/db/active_record", | ||
| 53 | "features/support/post_database", | ||
| 54 | "features/step_definitions/**.rb" | ||
| 55 | ] | ||
| 56 | t.rcov = true | ||
| 57 | t.rcov_opts = [ | ||
| 58 | '--exclude', 'spec', | ||
| 59 | '--exclude', 'gems', | ||
| 60 | '--exclude', 'riddle', | ||
| 61 | '--exclude', 'features' | ||
| 62 | ] | ||
| 63 | end | ||
| 64 | end | ||
| 65 | |||
| 66 | add_task :mysql, "Run feature-set against MySQL with rcov" | ||
| 67 | add_task :postgresql, "Run feature-set against PostgreSQL with rcov" | ||
| 68 | end | ||
| 69 | |||
| 70 | desc "Build cucumber.yml file" | ||
| 71 | task :cucumber_defaults do | ||
| 72 | default_requires = %w( | ||
| 73 | --require features/support/env.rb | ||
| 74 | --require features/support/db/mysql.rb | ||
| 75 | --require features/support/db/active_record.rb | ||
| 76 | --require features/support/post_database.rb | ||
| 77 | ).join(" ") | ||
| 78 | |||
| 79 | step_definitions = FileList["features/step_definitions/**.rb"].collect { |path| | ||
| 80 | "--require #{path}" | ||
| 81 | }.join(" ") | ||
| 82 | |||
| 83 | File.open('cucumber.yml', 'w') { |f| | ||
| 84 | f.write "default: \"#{default_requires} #{step_definitions}\"" | ||
| 85 | } | ||
| 86 | end | ||
