Sha256: 3d493c006409e832831f0734fb3b66d382b753ecc3e897982c16a8e3283de0f2

Contents?: true

Size: 1.24 KB

Versions: 10

Compression:

Stored size: 1.24 KB

Contents

# encoding: utf-8

require_relative '../test_helper'

class FixtureTest < ActiveSupport::TestCase
  
  def test_import_all
    Comfy::Cms::Page.destroy_all
    Comfy::Cms::Layout.destroy_all
    Comfy::Cms::Snippet.destroy_all
    
    assert_difference 'Comfy::Cms::Layout.count', 2 do
      assert_difference 'Comfy::Cms::Page.count', 2 do
        assert_difference 'Comfy::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
    comfy_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_export_all_with_no_site
    comfy_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

10 entries across 10 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-1.12.11 test/lib/fixtures_test.rb
comfortable_mexican_sofa-1.12.10 test/lib/fixtures_test.rb
comfortable_mexican_sofa-1.12.9 test/lib/fixtures_test.rb
comfortable_mexican_sofa-1.12.8 test/lib/fixtures_test.rb
comfortable_mexican_sofa-1.12.7 test/lib/fixtures_test.rb
comfortable_mexican_sofa-1.12.6 test/lib/fixtures_test.rb
comfortable_mexican_sofa-1.12.5 test/lib/fixtures_test.rb
comfortable_mexican_sofa-1.12.4 test/lib/fixtures_test.rb
comfortable_mexican_sofa-1.12.3 test/lib/fixtures_test.rb
comfortable_mexican_sofa-1.12.2 test/lib/fixtures_test.rb