diff --git a/motion/adapters/array_model_adapter.rb b/motion/adapters/array_model_adapter.rb index c7213aa..6142795 100644 --- a/motion/adapters/array_model_adapter.rb +++ b/motion/adapters/array_model_adapter.rb @@ -68,7 +68,7 @@ def find_by_id(id) # Returns query result as an array def all - collection + collection.dup end def order(field_name = nil, &block) diff --git a/spec/model_spec.rb b/spec/model_spec.rb index 6b6f22e..4cef48b 100644 --- a/spec/model_spec.rb +++ b/spec/model_spec.rb @@ -300,3 +300,11 @@ class ProtectedTimestamps end end end + +describe "#all" do + it "should return a new collection" do + x = Task.all.object_id + Task.create + Task.all.object_id.should != x + end +end