Skip to content

Instantly share code, notes, and snippets.

@victor-github
Created January 4, 2013 18:45
Show Gist options
  • Save victor-github/4454874 to your computer and use it in GitHub Desktop.
Save victor-github/4454874 to your computer and use it in GitHub Desktop.
RefineryCMS: make the default spec task include all extension specs. Add this to the bottom of your Rakefile. "bundle exec rake" will now execute all your specs
#!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
MyApp::Application.load_tasks
Rake.application.options.trace = true
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec)
extensions = []
Dir.new("vendor/extensions").entries.each { |e|
extensions << (eval "Refinery::#{e.camelcase}") unless (e == "." || e == "..")
}
Rails.application.config.extra_rspec_paths = extensions.map {|e| e.root}
task :default => :spec
RSpec::Core::RakeTask.module_eval do
def pattern
extras = []
Rails.application.config.extra_rspec_paths.each do |dir|
if File.directory?( dir )
extras << File.join( dir, 'spec', '**', '*_spec.rb' ).to_s
end
end
[@pattern] | extras
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment