Sha256: 7a397aa82c4a3dd205f55497f6de0c454ebe92190525985d1a6eb73a6f56cb93
Contents?: true
Size: 1.69 KB
Versions: 1
Compression:
Stored size: 1.69 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe DattsRight, "on the definition" do it "should not be created if it is not defined" do Page.create.dynamic_attribute_definition.should be_nil end describe ".defines?" do it "should return true if nil is passed, and it has the option and it's not empty" do Category.defines?.should be_true Category.new.defines?.should be_true end it "should return true if a class is passed, it has the option, and it defines the class" do Category.defines?(Page).should be_true Category.new.defines?(Page).should be_true Category.defines?(Page.new).should be_true Category.new.defines?(Page.new).should be_true end end describe ".defines" do it "should return the array of classes that it defines" do Category.defines.should == [:page] Category.new.defines.should == [:page] end it "should return nil if it does not define anything" do Page.defines.should be_nil Page.new.defines.should be_nil end end describe ".defined?" do it "should return true if it has the option and it's not empty" do Page.defined?.should be_true Page.new.defined?.should be_true end end describe ".defined_by?(klass_or_instance)" do it "should return true if a class is passed, it has the option, and it defines the class" do Page.defined_by?(Category).should be_true Page.defined_by?(Category.new).should be_true Page.defined_by?(:category).should be_true end it "should be the same as the instance method" do Page.should_receive(:defined_by?).with(Category) Page.new.defined_by?(Category) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
datts_right-0.0.32 | spec/datts_right/definition_spec.rb |