Sha256: 085c5d7cb3be4c7a2045ce443f5a95f3884987c20e9c6818ca6c74f060513ed8

Contents?: true

Size: 675 Bytes

Versions: 20

Compression:

Stored size: 675 Bytes

Contents

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

describe DattsRight, ".attributes=" do
  before do
    reset_database
    @page = Page.create
  end

  it "should accept a mix of normal and dynamic attributes" do
    @page.add_dynamic_attribute(:price, "integer", 200)
    @page.attributes = {:name => "fark", :price => 300}
    @page.name.should == "fark"
    @page.read_datt(:price).should == 300
  end

  it "should raise UnknownAttributeError if the attribute doesn't exist" do
    lambda {
      @page.attributes = {:name => "fark", :body => "lark"}
    }.should raise_error(ActiveRecord::UnknownAttributeError, "unknown attribute: body")
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
datts_right-0.0.32 spec/datts_right/attributes_spec.rb
datts_right-0.0.31 spec/datts_right/attributes_spec.rb
datts_right-0.0.30 spec/datts_right/attributes_spec.rb
datts_right-0.0.29 spec/datts_right/attributes_spec.rb
datts_right-0.0.28 spec/datts_right/attributes_spec.rb
datts_right-0.0.27 spec/datts_right/attributes_spec.rb
datts_right-0.0.26 spec/datts_right/attributes_spec.rb
datts_right-0.0.25 spec/datts_right/attributes_spec.rb
datts_right-0.0.24 spec/datts_right/attributes_spec.rb
datts_right-0.0.23 spec/datts_right/attributes_spec.rb
datts_right-0.0.22 spec/datts_right/attributes_spec.rb
datts_right-0.0.21 spec/datts_right/attributes_spec.rb
datts_right-0.0.20 spec/datts_right/attributes_spec.rb
datts_right-0.0.19 spec/datts_right/attributes_spec.rb
datts_right-0.0.18 spec/datts_right/attributes_spec.rb
datts_right-0.0.17 spec/datts_right/attributes_spec.rb
datts_right-0.0.16 spec/datts_right/attributes_spec.rb
datts_right-0.0.15 spec/datts_right/attributes_spec.rb
datts_right-0.0.14 spec/datts_right/attributes_spec.rb
datts_right-0.0.13 spec/datts_right/attributes_spec.rb