Sha256: 887d217e5aa99d866d0467ade6964de0818a99f177b0c5da8fb9ad82b2f2e1b3

Contents?: true

Size: 1.18 KB

Versions: 11

Compression:

Stored size: 1.18 KB

Contents

# encoding: utf-8

require_relative '../test_helper'

class FixtureTest < 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

11 entries across 11 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-1.11.2 test/lib/fixtures_test.rb
comfortable_mexican_sofa-1.11.1 test/lib/fixtures_test.rb
comfortable_mexican_sofa-1.11.0 test/lib/fixtures_test.rb
comfortable_mexican_sofa-1.10.3 test/lib/fixtures_test.rb
comfortable_mexican_sofa-1.10.2 test/lib/fixtures_test.rb
comfortable_mexican_sofa-1.10.1 test/lib/fixtures_test.rb
comfortable_mexican_sofa-1.10.0 test/lib/fixtures_test.rb
comfortable_mexican_sofa-1.9.3 test/models/fixtures_test.rb
comfortable_mexican_sofa-1.9.2 test/models/fixtures_test.rb
comfortable_mexican_sofa-1.9.1 test/models/fixtures_test.rb
comfortable_mexican_sofa-1.9.0 test/models/fixtures_test.rb