summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-06-28 10:52:26 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2012-06-28 10:52:26 +0200
commit38efe8f87d47915364f426eac41e465b4bdff279 (patch)
tree81ec7eda275fa74cfbc8ec6112bcd10e213817ce
parentb9b8b59d6a7d7437318272e436548052175d4e03 (diff)
downloadedoors-ruby-38efe8f87d47915364f426eac41e465b4bdff279.zip
edoors-ruby-38efe8f87d47915364f426eac41e465b4bdff279.tar.gz
specs: cover Particle#each_merged
-rw-r--r--spec/particle_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/particle_spec.rb b/spec/particle_spec.rb
index 8d926ef..b8b39ae 100644
--- a/spec/particle_spec.rb
+++ b/spec/particle_spec.rb
@@ -47,11 +47,29 @@ describe Edoors::Particle do
p.merged(0).should be q
p.merged(1).should be o
p.merged(2).should be_nil
+ c = 0
+ p.each_merged do |o|
+ o.should be p.merged(c)
+ c+=1
+ end
+ c.should be 2
p.merged_shift.should be q
p.merged(0).should be o
p.merged(1).should be_nil
+ c = 0
+ p.each_merged do |o|
+ o.should be p.merged(c)
+ c+=1
+ end
+ c.should be 1
p.merged_shift.should be o
p.merged(0).should be_nil
+ c = 0
+ p.each_merged do |o|
+ o.should be p.merged(c)
+ c+=1
+ end
+ c.should be 0
p.merge! q
p.merge! o
p.merged(0).should be q