Sha256: e12b5f0a6efd28933ce3c0a097dd576b083a280bb281ed1996e625da853c1e1c

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

require File.dirname(__FILE__) + "/../../spec_helper"

describe Kajam::Exporter do
  dataset :pages_with_layouts, :users_and_pages, :snippets
  
  let(:exporter){ Kajam::Exporter }
  let(:exported_content){ exporter.export }
  let(:exported_hash){ YAML::load(exported_content) }
  subject { exporter }
  
  specify{ exported_content.should be_kind_of(String) }
  
  it "should output all exportable_models with pluralized class names as keys" do
    exporter.exportable_models.all? { |c| exported_hash.has_key?(c.to_s.pluralize) }.should be_true
  end
  
  it "should output the models by id as hashes" do
    exported_hash['Pages'][page_id(:home)]['title'].should == pages(:home).title
    exported_hash['Users'][user_id(:admin)]['name'].should == users(:admin).name
  end
  
  its(:exportable_models){ should == [Kajam::Config, User, Page, PagePart, PageField, Snippet, Layout] }
  its(:template_models){ should == [Layout, Snippet, Page, PagePart, PageField] }
  its(:ignored_template_attributes){ should == [:lock_version, :created_at, :updated_at, :created_by_id, :updated_by_id] }
  it "should allow setting exportable_models" do
    exporter.exportable_models = [Page]
    exporter.exportable_models.should == [Page]
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kajam-1.0.3.rc2 vendor/extensions/exporter/spec/models/kajam/exporter_spec.rb