Skip to content

Commit

Permalink
a few more passing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
raganwald committed Sep 30, 2009
1 parent 1f6258c commit 60d5aab
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions spec/block_anaphora_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,58 @@

end

describe "not an anaphor" do

before(:each) do
@source = RewriteRails.clean do
total = 0
3.times {
(1..10).each { |it|
total += it
}
}
end
@target = RewriteRails.clean do
total = 0
3.times {
(1..10).each { |it|
total += it
}
}
end
end

it "should not add the anaphor to the outer block because the reference occurs" do
@it.process(@source).to_a.should == @target.to_a
end

end

describe "a nested anaphor" do

before(:each) do
@source = RewriteRails.clean do
3.times {
(1..10).each { |number|
it += number
}
}
end
@target = RewriteRails.clean do
3.times { |it|
(1..10).each { |number|
it += number
}
}
end
end

it "should add the anaphor to the outer block because the reference occurs" do
@it.process(@source).to_a.should == @target.to_a
end

end

end

end

0 comments on commit 60d5aab

Please sign in to comment.