require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe DattsRight, ".remove_dynamic_attribute(attr_key)" do before do reset_database @page = Page.create end it "should be aliased by remove_datt" do Page.instance_method(:remove_dynamic_attribute).should == Page.instance_method(:remove_datt) end it "should remove the attribute completely" do @page.add_dynamic_attribute(:rocks, "string") @page.remove_dynamic_attribute(:rocks) lambda { @page.rocks }.should raise_error(NoMethodError) end it "should not explode if the attribute being removed isn't there" do @page.add_dynamic_attribute(:rocks, "string") @page.remove_dynamic_attribute(:rocks) lambda { @page.remove_dynamic_attribute(:rocks) }.should_not raise_error(NoMethodError) end end