Sha256: 1e1ef91e35efb8482aebbf259f79193764c76d379da3edf4e71c43b0dd3c1569

Contents?: true

Size: 955 Bytes

Versions: 3

Compression:

Stored size: 955 Bytes

Contents

require_relative "../test_helper"
require "rake"

class CmsSeedsTaskTest < ActiveSupport::TestCase

  setup do
    @rake = Rake::Application.new
    Rake.application = @rake
    # We force rake file reload by passing empty array as the last parameter
    Rake.application.rake_require("tasks/cms_seeds", $LOAD_PATH, [])
    Rake::Task.define_task(:environment)
  end

  def test_import
    importer = mock()
    ComfortableMexicanSofa::Seeds::Importer.expects(:new).with("from_folder", "to_site").returns(importer)
    importer.expects(:import!)

    with_captured_stout do
      @rake["comfy:cms_seeds:import"].invoke("from_folder", "to_site")
    end
  end

  def test_export
    exporter = mock()
    ComfortableMexicanSofa::Seeds::Exporter.expects(:new).with("from_site", "to_folder").returns(exporter)
    exporter.expects(:export!)

    with_captured_stout do
      @rake["comfy:cms_seeds:export"].invoke("from_site", "to_folder")
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-2.0.2 test/tasks/cms_seeds_test.rb
comfortable_mexican_sofa-2.0.1 test/tasks/cms_seeds_test.rb
comfortable_mexican_sofa-2.0.0 test/tasks/cms_seeds_test.rb