diff --git a/Rakefile b/Rakefile index 6aed2d4c1ae..a3affad8345 100644 --- a/Rakefile +++ b/Rakefile @@ -2,6 +2,7 @@ require 'rake' require 'rubygems/package_task' require 'thor/group' require File.expand_path('../lib/generators/spree/install/install_generator', __FILE__) +require 'spree/core/testing_support/common_rake' spec = eval(File.read('spree.gemspec')) Gem::PackageTask.new(spec) do |pkg| @@ -21,6 +22,15 @@ def run_all_tests(database_name) #end end +desc "Generates a dummy app for testing for every Spree engine" +task :test_app do + %w(api auth core dash promo).each do |engine| + ENV['LIB_NAME'] = File.join('spree', engine) + ENV['DUMMY_PATH'] = File.expand_path("../#{engine}/spec/dummy", __FILE__) + Rake::Task['common:test_app'].execute + end +end + task :default => :all_tests desc "Run all tests for sqlite3 only" diff --git a/core/lib/generators/spree/dummy/dummy_generator.rb b/core/lib/generators/spree/dummy/dummy_generator.rb index db377ac7edb..cf215bb850d 100644 --- a/core/lib/generators/spree/dummy/dummy_generator.rb +++ b/core/lib/generators/spree/dummy/dummy_generator.rb @@ -67,7 +67,7 @@ def cucumber_environment protected def dummy_path - 'spec/dummy' + ENV['DUMMY_PATH'] || 'spec/dummy' end def module_name diff --git a/core/lib/spree/core/testing_support/common_rake.rb b/core/lib/spree/core/testing_support/common_rake.rb index 6ff768a45af..c01bb8a6d30 100644 --- a/core/lib/spree/core/testing_support/common_rake.rb +++ b/core/lib/spree/core/testing_support/common_rake.rb @@ -1,4 +1,6 @@ -require '../lib/generators/spree/install/install_generator' +unless defined?(Spree::InstallGenerator) + require '../lib/generators/spree/install/install_generator' +end desc "Generates a dummy app for testing" namespace :common do diff --git a/core/lib/tasks/core.rake b/core/lib/tasks/core.rake index 1ce4fa97c3f..0c74999bda5 100644 --- a/core/lib/tasks/core.rake +++ b/core/lib/tasks/core.rake @@ -2,7 +2,7 @@ require 'active_record' require 'spree/core/custom_fixtures' namespace :db do - desc %q{Loads a specified fixture file: + desc %q{Loads a specified fixture file: For .yml/.csv use rake db:load_file[spree/filename.yml, /absolute/path/to/parent/] For .rb use rake db:load_file[/absolute/path/to/sample/filename.rb]} @@ -12,11 +12,9 @@ For .rb use rake db:load_file[/absolute/path/to/sample/filename.rb]} if %w{.csv .yml}.include? file.extname puts "loading fixture #{Pathname.new(args.dir).join(file)}" Spree::Core::Fixtures.create_fixtures(args.dir, file.to_s.sub(file.extname, "")) - else - if file.exist? - puts "loading ruby #{file}" - require file - end + elsif file.exist? + puts "loading ruby #{file}" + require file end end