require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe DattsRight, ".remove_definition(key, value)" do before do reset_database end it "should remove a definition from the existing definition" do c = Category.create c.definition = {:robot => {:object_type => "string"}} c.save c.remove_definition(:robot) c.definition[:robot].should be_nil end it "should raise NotDefinedError if it doesn't exist" do lambda {Category.create.remove_definition(:robot)}.should raise_error(DattsRight::NotDefinedError, "robot is not defined") end it "should raise NoDefinitionError if it doesn't have definition => true" do lambda {Page.create.remove_definition(:fake)}.should raise_error(DattsRight::NoDefinitionError) end end