Sha256: a2448e7e67822f928544b30ece26e7330a4c7426b8d9bd775ea481c269443d53

Contents?: true

Size: 1.18 KB

Versions: 15

Compression:

Stored size: 1.18 KB

Contents

ENV["RAILS_ROOT"] ||= 'spec/internal'

desc "Run specs"
task :spec => [:generate, :fixtures] do |t|
  Bundler.with_clean_env do
    within_test_app do
      system "rake myspec"
      abort "Error running hydra-core" unless $?.success?
    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

15 entries across 15 versions & 1 rubygems

Version Path
hydra-core-6.0.0.pre8 tasks/rspec.rake
hydra-core-6.0.0.pre7 tasks/rspec.rake
hydra-core-6.0.0.pre6 tasks/rspec.rake
hydra-core-6.0.0.pre5 tasks/rspec.rake
hydra-core-6.0.0.pre4 tasks/rspec.rake
hydra-core-6.0.0.pre3 tasks/rspec.rake
hydra-core-6.0.0.pre2 tasks/rspec.rake
hydra-core-6.0.0.pre1 tasks/rspec.rake
hydra-core-5.4.0.pre1 tasks/rspec.rake
hydra-core-5.3.0 tasks/rspec.rake
hydra-core-5.2.0 tasks/rspec.rake
hydra-core-5.1.0 tasks/rspec.rake
hydra-core-5.0.1 tasks/rspec.rake
hydra-core-5.0.0 tasks/rspec.rake
hydra-core-5.0.0.rc1 tasks/rspec.rake