spec/model/queries_spec.rb in architect4r-0.3.4.2 vs spec/model/queries_spec.rb in architect4r-0.4
- old
+ new
@@ -8,11 +8,11 @@
it { should respond_to(:find_by_id) }
it "should find a node based on its id" do
person = Person.create(:name => 'Agent Smith', :human => false)
- person.persisted?.should be_true
+ person.should be_persisted
record = Person.find_by_id(person.id)
record.should be_a(Person)
record.id.should == person.id
end
@@ -24,11 +24,11 @@
it "should return nil when the node is not found" do
Person.find_by_id(-1).should be_nil
end
- it "should raise an exception when banged finder is used an no record found" do
+ it "should raise an exception when banged finder is used and no record found" do
lambda { Person.find_by_id!(-1) }.should raise_error(Architect4r::RecordNotFound)
end
it "should not raise an exception when banged finder is used an a record is found" do
person = Person.create(:name => 'The Architect', :human => false)
@@ -54,9 +54,17 @@
Person.create(:name => 'Trinity', :human => true)
Person.create(:name => 'Morpheus', :human => true)
results = Person.find_by_cypher("start s=node(:person_root) match s<-[:model_type]-d return d limit 2", 'd')
results.size.should == 2
results.first.should be_a(Person)
+ end
+
+ end
+
+ describe ".all" do
+
+ it "should return all records" do
+ Person.all.size.should == Person.count
end
end
end