Sha256: f37ee2e8795d31184ac24245ed0409b80e3d6f236ecf2624528a2fe156a7145d

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

ENV["RAILS_ROOT"] ||= 'spec/internal'
require 'rspec/core/rake_task'


desc "Run specs"
task :spec => [:generate, :fixtures] do |t|
  Bundler.with_clean_env do
    within_test_app do
      system "rake myspec"
    end
  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`
    Bundler.with_clean_env do
      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
  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')
  yield
  FileUtils.cd('../..')
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hydra-core-5.0.0.pre15 tasks/rspec.rake