Sha256: 4382767beadc4ded3a6f68a6d07784bc9942d336755bd3f83099cfc5a0c3c002

Contents?: true

Size: 1.65 KB

Versions: 1

Compression:

Stored size: 1.65 KB

Contents

ENV['BUNDLE_GEMFILE'] = File.dirname(__FILE__) + '/../spec/rails_3_0_0_root/Gemfile'

require 'rake'
require 'rake/testtask'
require 'rspec'
require 'rspec/core/rake_task'


desc "Run the test suite"
task :spec => ['spec:setup', 'spec:rules_view', 'spec:cleanup']

namespace :spec do
  desc "Setup the test environment"
  task :setup do
    rules_view_rails_path = File.expand_path(File.dirname(__FILE__) + '/../spec/rails_3_0_0_root')

    system "cd #{rules_view_rails_path} && bundle install"
    system "cd #{rules_view_rails_path} && ./script/rails generate rules_view:install"
  end
  
  desc "Cleanup the test environment"
  task :cleanup do
    rules_view_rails_path = File.expand_path(File.dirname(__FILE__) + '/../spec/rails_3_0_0_root')
    
    FileUtils.rm_rf("#{rules_view_rails_path}/public/stylesheets/rules_view")
    FileUtils.rm_rf("#{rules_view_rails_path}/public/javascripts/rules_view")
    FileUtils.rm_rf("#{rules_view_rails_path}/config/initializers/rules_view.rb")
    FileUtils.rm_rf("#{rules_view_rails_path}/doc/README.rules_view")
    FileUtils.rm_rf("#{rules_view_rails_path}/Gemfile.lock")
  end

  desc "Test the rules_view"
  RSpec::Core::RakeTask.new(:rules_view) do |task|
    rules_engine_root = File.expand_path(File.dirname(__FILE__) + '/..')
    task.pattern = rules_engine_root + '/spec/lib/rules_view/**/*_spec.rb'
  end

  desc "Run the coverage report"
  RSpec::Core::RakeTask.new(:rcov) do |task|
    rules_engine_root = File.expand_path(File.dirname(__FILE__) + '/..')
    task.pattern = rules_engine_root + '/spec/lib/**/*_spec.rb'
    task.rcov=true
    task.rcov_opts = %w{--rails --exclude osx\/objc,gems\/,spec\/,features\/}
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rules_view-0.0.1 tasks/rspec.rake