Skip to content

Commit

Permalink
Removed rake refinery:testing:specs and fixed rake spec.
Browse files Browse the repository at this point in the history
  • Loading branch information
parndt committed Dec 6, 2014
1 parent 3aea1ee commit 97bfccb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 27 deletions.
4 changes: 2 additions & 2 deletions tasks/rspec.rake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ require 'rspec/core/rake_task'

desc "Run specs"
RSpec::Core::RakeTask.new do |t|
t.pattern = "./*/spec"
t.pattern = "./*/spec/**/*_spec.rb"
end

task :spec => "refinery:testing:dummy_app"
task :spec
32 changes: 7 additions & 25 deletions testing/lib/refinery/tasks/testing.rake
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
namespace :refinery do
namespace :testing do
desc "Generates a dummy app for testing"
desc "Generates a dummy application for testing, if one doesn't exist."
task :dummy_app => [
:report_dummy_app_status,
:create_dummy_app
]

desc "Creates a dummy application for testing"
task :create_dummy_app => [
:setup_dummy_app,
:setup_extension,
:init_test_database
]

desc "raises if there is already a dummy app"
desc "raises if there is already a dummy application"
task :report_dummy_app_status do
raise "\nPlease rm -rf '#{dummy_app_path}'\n\n" if dummy_app_path.exist?
end
Expand Down Expand Up @@ -56,29 +61,6 @@ namespace :refinery do
system "RAILS_ENV=test bundle exec rake -f #{File.join(dummy_app_path, 'Rakefile')} db:create db:migrate"
end

task :specs do
paths = Dir.glob('vendor/extensions/*/spec')
paths << Rails.root

status = 0
paths.each do |path|
if Rails.root.join(path).basename.to_s == 'spec'
path = Rails.root.join(path).parent
end
cmd = "running specs in #{ path.basename }"
puts "\n#{ "-" * cmd.to_s.length }\n#{ cmd }\n#{"-" * cmd.to_s.length }"
Dir.chdir(path) do
IO.popen("bundle exec bundle install && bundle exec rake refinery:testing:dummy_app") unless path == Rails.root
IO.popen("bundle exec rake spec") do |f|
f.each { |line| puts line }
f.close
status = 1 if $?.to_i > 0
end
end
end
abort "Some tests failed" if status > 0
end

def dummy_app_path
Refinery::Testing::Railtie.target_extension_path.join('spec', 'dummy')
end
Expand Down

0 comments on commit 97bfccb

Please sign in to comment.