Sha256: b57053bce55723d87d33c9091267e6ef98bd7281dbf75cde2074b19967e38ea0

Contents?: true

Size: 1.15 KB

Versions: 2

Compression:

Stored size: 1.15 KB

Contents

require "spec_helper"

describe "Model Node" do
  
  subject { Person }
  
  describe :new do
    
    it { should respond_to(:new) }
    
    it "should accept a hash of properties with strings as keys" do
      piano = subject.new({ 'name' => 'Neo' })
      piano.should respond_to(:name)
      piano.name.should eql('Neo')
    end
    
    it "should accept a hash of properties with symbols as keys" do
      piano = subject.new({ :name => 'Neo' })
      piano.should respond_to(:name)
      piano.name.should eql('Neo')
    end
  end
  
  describe "connection" do
    
    it { should respond_to(:connection) }
    
    its(:connection) { should respond_to(:get) }
    
  end
  
  describe "node model_root" do
    
    it "should create a model_root node if there is none" do
      Person.create(:name => 'Morpheus', :human => true)
      Person.model_root.should_not be_nil
    end
    
    it "should reuse an existing model_root if there is already one" do
      Person.create(:name => 'Morpheus', :human => true)
      m_root = Person.model_root
      Person.create(:name => 'Trinity', :human => true)
      Person.model_root.should == m_root
    end
    
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
architect4r-0.3.3.1 spec/model/node_spec.rb
architect4r-0.3.2 spec/model/node_spec.rb