Sha256: a354def36c686438c1e12add0cc05ac0e0a77fc1dea8942d9b5e980d3683972c

Contents?: true

Size: 1.18 KB

Versions: 2

Compression:

Stored size: 1.18 KB

Contents

# encoding: utf-8

require_relative '../test_helper'

class FixturesTest < ActiveSupport::TestCase
  
  def test_import_all
    Cms::Page.destroy_all
    Cms::Layout.destroy_all
    Cms::Snippet.destroy_all
    
    assert_difference 'Cms::Layout.count', 2 do
      assert_difference 'Cms::Page.count', 2 do
        assert_difference 'Cms::Snippet.count', 1 do
          ComfortableMexicanSofa::Fixture::Importer.new('sample-site', 'default-site').import!
        end
      end
    end
  end
  
  def test_import_all_with_no_site
    cms_sites(:default).destroy
    
    assert_exception_raised ActiveRecord::RecordNotFound do
      ComfortableMexicanSofa::Fixture::Importer.new('sample-site', 'default-site').import!
    end
  end
  
  def test_export_all
    host_path = File.join(ComfortableMexicanSofa.config.fixtures_path, 'test-site')
    ComfortableMexicanSofa::Fixture::Exporter.new('default-site', 'test-site').export!
    FileUtils.rm_rf(host_path)
  end
  
  def test_import_all_with_no_site
    cms_sites(:default).destroy
    
    assert_exception_raised ActiveRecord::RecordNotFound do
      ComfortableMexicanSofa::Fixture::Exporter.new('sample-site', 'default-site').export!
    end
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-1.8.5 test/unit/fixtures_test.rb
comfortable_mexican_sofa-1.8.4 test/unit/fixtures_test.rb