Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

82 lines (68 sloc) 2.788 kb
# encoding: utf-8
ENV['BUNDLE_GEMFILE'] = File.dirname(__FILE__) + '/test/rails_root/Gemfile'
require 'rake'
require 'rake/testtask'
require 'cucumber/rake/task'
namespace :test do
Rake::TestTask.new(:basic => ["generator:cleanup",
"generator:clearance"]) do |task|
task.libs << "lib"
task.libs << "test"
task.pattern = "test/*/*_test.rb"
task.verbose = false
end
Rake::TestTask.new(:views => ["generator:cleanup",
"generator:clearance",
"generator:clearance_views"]) do |task|
task.libs << "lib"
task.libs << "test"
task.pattern = "test/*/*_test.rb"
task.verbose = false
end
Cucumber::Rake::Task.new(:features => ["generator:cleanup",
"generator:clearance",
"generator:clearance_features"]) do |t|
t.cucumber_opts = "--format progress"
t.profile = 'features'
end
Cucumber::Rake::Task.new(:features_for_views => ["generator:cleanup",
"generator:clearance",
"generator:clearance_features",
"generator:clearance_views"]) do |t|
t.cucumber_opts = "--format progress"
t.profile = 'features_for_views'
end
end
namespace :generator do
desc "Cleans up the test app before running the generator"
task :cleanup do
FileList["test/rails_root/db/**/*"].each do |each|
FileUtils.rm_rf(each)
end
FileUtils.rm_rf("test/rails_root/vendor/plugins/clearance")
FileUtils.rm_rf("test/rails_root/app/views/passwords")
FileUtils.rm_rf("test/rails_root/app/views/sessions")
FileUtils.rm_rf("test/rails_root/app/views/users")
FileUtils.mkdir_p("test/rails_root/vendor/plugins")
clearance_root = File.expand_path(File.dirname(__FILE__))
system("ln -s #{clearance_root} test/rails_root/vendor/plugins/clearance")
FileList["test/rails_root/features/*.feature"].each do |each|
FileUtils.rm_rf(each)
end
end
desc "Run the clearance generator"
task :clearance do
system "cd test/rails_root && bundle install && ./script/rails generate clearance && rake db:migrate db:test:prepare"
end
desc "Run the clearance features generator"
task :clearance_features do
system "cd test/rails_root && ./script/rails generate clearance_features"
end
desc "Run the clearance views generator"
task :clearance_views do
system "cd test/rails_root && ./script/rails generate clearance_views"
end
end
desc "Run the test suite"
task :default => ['test:basic', 'test:features',
'test:views', 'test:features_for_views']
Jump to Line
Something went wrong with that request. Please try again.