Sha256: 1ad768d73045ffb1d817142bc21deee3378a5aa5a05cc54111dd72b3b57714bb

Contents?: true

Size: 1.91 KB

Versions: 2

Compression:

Stored size: 1.91 KB

Contents

require 'rubygems'
require 'rspec/core/rake_task'
require 'cucumber/rake/task'

desc "Run the specs under spec"
RSpec::Core::RakeTask.new do |t|
  t.pattern = 'spec/**/*_spec.rb'
end
task :spec => :check_dependencies

desc "Run all feature-set configurations"
task :features do |t|
  databases = ENV['DATABASES'] || 'mysql,postgresql'
  databases.split(',').each do |database|
    puts   "rake features:#{database}"
    system "rake features:#{database}"
  end
end

namespace :features do
  def add_task(name, description)
    Cucumber::Rake::Task.new(name, description) do |t|
      t.cucumber_opts = "--format pretty features/*.feature DATABASE=#{name} --exclude features/thinking_sphinx"
    end
  end
  
  add_task :mysql,      "Run feature-set against MySQL"
  add_task :postgresql, "Run feature-set against PostgreSQL"
  
  task :mysql      => :check_dependencies
  task :postgresql => :check_dependencies
end

desc "Generate RCov reports"
RSpec::Core::RakeTask.new(:rcov) do |t|
  t.pattern = 'spec/**/*_spec.rb'
  t.rcov = true
  t.rcov_opts = [
    '--exclude', 'spec',
    '--exclude', 'gems',
    '--exclude', 'riddle',
    '--exclude', 'ruby'
  ]
end

namespace :rcov do
  def add_task(name, description)
    Cucumber::Rake::Task.new(name, description) do |t|
      t.cucumber_opts = "--format pretty"
      t.profile = name
      t.rcov = true
      t.rcov_opts = [
        '--exclude', 'spec',
        '--exclude', 'gems',
        '--exclude', 'riddle',
        '--exclude', 'features'
      ]
    end
  end
  
  add_task :mysql,      "Run feature-set against MySQL with rcov"
  add_task :postgresql, "Run feature-set against PostgreSQL with rcov"
end

desc "Build cucumber.yml file"
task :cucumber_defaults do
  steps = FileList["features/step_definitions/**.rb"].collect { |path|
    "--require #{path}"
  }.join(" ")
  
  File.open('cucumber.yml', 'w') { |f|
    f.write "default: \"--require features/support/env.rb #{steps}\"\n"
  }
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
thinking-sphinx-2.0.0.rc2 tasks/testing.rb
thinking-sphinx-2.0.0.rc1 tasks/testing.rb