Skip to content

Commit

Permalink
Merge pull request spree#798 from parndt/rake_test_app_optimisations
Browse files Browse the repository at this point in the history
Rake test app optimisations
  • Loading branch information
radar committed Nov 20, 2011
2 parents 9c613d5 + 6a2d367 commit 93162e1
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
10 changes: 10 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion core/lib/generators/spree/dummy/dummy_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def cucumber_environment

protected
def dummy_path
'spec/dummy'
ENV['DUMMY_PATH'] || 'spec/dummy'
end

def module_name
Expand Down
4 changes: 3 additions & 1 deletion core/lib/spree/core/testing_support/common_rake.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 4 additions & 6 deletions core/lib/tasks/core.rake
Original file line number Diff line number Diff line change
Expand Up @@ -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]}

Expand All @@ -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

Expand Down

0 comments on commit 93162e1

Please sign in to comment.