Sha256: 5d3c61bfabcc84747be1bef49f7a60a95c46b21c3668f66609fe2efe472107eb
Contents?: true
Size: 1.28 KB
Versions: 11
Compression:
Stored size: 1.28 KB
Contents
ENV["RAILS_ROOT"] ||= 'spec/internal' GEM_ROOT= File.expand_path(File.join(File.dirname(__FILE__),"..")) desc "Run specs" task :spec => [:generate, :fixtures] do |t| focused_spec = ENV['SPEC'] ? " SPEC=#{File.join(GEM_ROOT, ENV['SPEC'])}" : '' within_test_app do system "rake myspec#{focused_spec}" abort "Error running hydra-core" unless $?.success? end end task :fixtures do within_test_app do system "rake hydra:fixtures:refresh RAILS_ENV=test" end end desc "Create the test rails app" task :generate do unless File.exists?('spec/internal/Rakefile') puts "Generating rails app" `rails new spec/internal` puts "Copying gemfile" `cp spec/support/Gemfile spec/internal` puts "Copying generator" `cp -r spec/support/lib/generators spec/internal/lib` within_test_app do puts "Bundle install" `bundle install` puts "running test_app_generator" system "rails generate test_app" puts "running migrations" puts `rake db:migrate db:test:prepare` end end puts "Running specs" end desc "Clean out the test rails app" task :clean do puts "Removing sample rails app" `rm -rf spec/internal` end def within_test_app FileUtils.cd('spec/internal') Bundler.with_clean_env do yield end FileUtils.cd('../..') end
Version data entries
11 entries across 11 versions & 1 rubygems