Sha256: daa0ddad018422b8f4a60096939ab5c4af66884299e332a163358fb79b156303

Contents?: true

Size: 895 Bytes

Versions: 1

Compression:

Stored size: 895 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe DattsRight, ".sync_definition!" do
  before do
    reset_database
    @category = Category.create
    @category.definition = {:teaser => {:object_type => "text"}, :body => {:object_type => "text"}}
    @category.save
    @page = Page.create :category => @category
  end

  it "should add any new definitions" do
    @category.add_definition(:price, {:object_type => "integer"})
    @category.save
    @page.sync_definition!
    @page.dynamic_attribute_details(:price)[:object_type].should == "integer"
  end

  it "should remove any dynamic attributes if the definitions are removed" do
    @category.remove_definition(:body)
    @category.save
    @page.sync_definition!
    @page.dynamic_attribute_details(:teaser)[:object_type].should == "text"
    lambda {@page.body}.should raise_error(NoMethodError)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
datts_right-0.0.32 spec/datts_right/sync_definition_spec.rb