diff options
-rw-r--r-- | TODO | 4 | ||||
-rw-r--r-- | spec/active_relation/unit/relations/relation_spec.rb | 6 | ||||
-rw-r--r-- | spec/active_relation/unit/relations/table_spec.rb | 5 |
3 files changed, 10 insertions, 5 deletions
@@ -1,5 +1,4 @@ todo: -- clarify distinction between engine and connection: an engine is a connection pool, plus the quoting operations - clean up integration tests in join - i find the aggregate stuff too integrationy; unit testing would be better - test relation, table reset - cache expiry on write @@ -8,7 +7,8 @@ todo: - descend on array, along with bind written in terms of it - standardize quoting - use strings everywhere, not symbols ? -- rename and test sql strategies +- rename sql strategies +- test sql strategies - the parallel names are confusing since it's not obvious what's what. plus, we lack unit tests; the biggest complaint is a lack of clarity concerning what purpose these serve in the system. Unit tests wont illustrate much unless we use concrete examples. - rename the tion (Selection) classes so that words that don't end in tion don't seem inconsistent - re-evaluate bind diff --git a/spec/active_relation/unit/relations/relation_spec.rb b/spec/active_relation/unit/relations/relation_spec.rb index 2e9f7fd3c8..5e434e52a6 100644 --- a/spec/active_relation/unit/relations/relation_spec.rb +++ b/spec/active_relation/unit/relations/relation_spec.rb @@ -156,7 +156,11 @@ module ActiveRelation describe Relation::Enumerable do it "is enumerable" do - pending + pending "I don't like this mock-based test" + data = [1,2,3] + mock.instance_of(Session).read(anything) { data } + @relation.collect.should == data + @relation.first.should == data.first end end end diff --git a/spec/active_relation/unit/relations/table_spec.rb b/spec/active_relation/unit/relations/table_spec.rb index 41ed2dc404..e62f84d93a 100644 --- a/spec/active_relation/unit/relations/table_spec.rb +++ b/spec/active_relation/unit/relations/table_spec.rb @@ -92,8 +92,9 @@ module ActiveRelation end describe '#reset' do - it "" do - pending + it "reloads columns from the database" do + lambda { stub(@relation).columns { [] } }.should_not change { @relation.attributes } + lambda { @relation.reset }.should change { @relation.attributes } end end end |