Sha256: 99e12c59e1b0341173b817e6ac5249862fa391e7f57a30075b13b773fe1a54f8

Contents?: true

Size: 1.17 KB

Versions: 3

Compression:

Stored size: 1.17 KB

Contents

require 'rubygems'
require 'bundler/setup'
require 'bundler/gem_tasks'

require 'rake'
require 'rspec'

require_relative 'lib/locomotive/steam'

namespace :mongodb do
  namespace :test do
    desc 'Seed the MongoDB database with the dump of the Sample website'
    task :seed do
      root_path = File.expand_path(File.dirname(__FILE__))
      db_path   = File.join(root_path, 'spec', 'fixtures', 'mongodb')

      if database = ENV['DATABASE']
        dump_path = File.join(root_path, 'dump', database)

        `rm -rf #{db_path}`
        `mongodump --db #{database}`
        `mv #{dump_path} #{db_path}`
      end

      `mongo steam_test_1_5_x --eval "db.dropDatabase()"`
      `mongorestore -d steam_test_1_5_x #{db_path}`

      puts "Done! Update now the spec/support/helpers.rb file by setting the new id of the site returned by the mongodb_site_id method"
    end
  end
end

require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new('spec')

RSpec::Core::RakeTask.new('spec:integration') do |spec|
  spec.pattern = 'spec/integration/**/*_spec.rb'
end

RSpec::Core::RakeTask.new('spec:unit') do |spec|
  spec.pattern = 'spec/unit/**/*_spec.rb'
end

task default: ['mongodb:test:seed', :spec]

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
locomotivecms_steam-1.5.0.beta3 Rakefile
locomotivecms_steam-1.5.0.beta2 Rakefile
locomotivecms_steam-1.5.0.beta1 Rakefile