Sha256: 46e45a8634a4528bc0abaaa6d05a8fe2c474bcdac1f09d82b4e5c4771c220ebb

Contents?: true

Size: 1.3 KB

Versions: 10

Compression:

Stored size: 1.3 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 ENV['MONGO_HOST']
        host = "--host=#{ENV['MONGO_HOST']}"
      else
        host = ""
      end

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

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

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

      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

10 entries across 10 versions & 1 rubygems

Version Path
locomotivecms_steam-1.6.1 Rakefile
locomotivecms_steam-1.6.0 Rakefile
locomotivecms_steam-1.6.0.rc1 Rakefile
locomotivecms_steam-1.6.0.beta1 Rakefile
locomotivecms_steam-1.5.3 Rakefile
locomotivecms_steam-1.5.2 Rakefile
locomotivecms_steam-1.5.1 Rakefile
locomotivecms_steam-1.5.0 Rakefile
locomotivecms_steam-1.5.0.rc1 Rakefile
locomotivecms_steam-1.5.0.rc0 Rakefile