Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Ensure scopes are not mutated.

  • Loading branch information...
commit a53748917151f24fdef220623e4460cb0bf8be1e 1 parent 65d006a
Eloy Durán authored August 11, 2012

Showing 1 changed file with 17 additions and 1 deletion. Show diff stats Hide diff stats

  1. 18  spec/scope_spec.rb
18  spec/scope_spec.rb
@@ -62,7 +62,23 @@ module MotionData
62 62
     end
63 63
 
64 64
     it "does not modify the original scopes" do
65  
-      
  65
+      scope1 = Scope.alloc.initWithTarget(Author)
  66
+
  67
+      scope2 = scope1.where(:name => 'bob')
  68
+      scope2.object_id.should.not == scope1.object_id
  69
+      scope2.predicate.object_id.should.not == scope1.predicate.object_id
  70
+
  71
+      scope3 = scope2.where(value(:name) == 'bob')
  72
+      scope3.object_id.should.not == scope2.object_id
  73
+      scope3.predicate.object_id.should.not == scope2.predicate.object_id
  74
+
  75
+      scope4 = scope3.where('name == %@', 'bob')
  76
+      scope4.object_id.should.not == scope3.object_id
  77
+      scope4.predicate.object_id.should.not == scope3.predicate.object_id
  78
+
  79
+      scope5 = scope4.where(NSPredicate.predicateWithFormat('name == "bob"'))
  80
+      scope5.object_id.should.not == scope4.object_id
  81
+      scope5.predicate.object_id.should.not == scope4.predicate.object_id
66 82
     end
67 83
   end
68 84
 

0 notes on commit a537489

Please sign in to comment.
Something went wrong with that request. Please try again.