aboutsummaryrefslogtreecommitdiffstats
path: root/spec/arel/nodes/select_core_spec.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-08-19 10:38:07 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-08-19 10:38:07 -0700
commit3283adc6d0edcc873256c78842f8ddd233577d08 (patch)
treea92d64c67ea987f65a465dbac97195cde4fbc820 /spec/arel/nodes/select_core_spec.rb
parent6451188abf647d6aa855d22db8d2d62a2b2c4542 (diff)
parent06c92a8557f5171704a121d0f4412e4c1e9a9c2b (diff)
downloadrails-3283adc6d0edcc873256c78842f8ddd233577d08.tar.gz
rails-3283adc6d0edcc873256c78842f8ddd233577d08.tar.bz2
rails-3283adc6d0edcc873256c78842f8ddd233577d08.zip
Merge branch 'v1' of github.com:flavorjones/arel into v1
* 'v1' of github.com:flavorjones/arel: DeleteStatement deep copy cleaning up describe/it block names SelectCore deep copies attributes Statement nodes deep-copy AST nodes TreeManager classes deep-copy their statements.
Diffstat (limited to 'spec/arel/nodes/select_core_spec.rb')
-rw-r--r--spec/arel/nodes/select_core_spec.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/arel/nodes/select_core_spec.rb b/spec/arel/nodes/select_core_spec.rb
new file mode 100644
index 0000000000..cf717a3904
--- /dev/null
+++ b/spec/arel/nodes/select_core_spec.rb
@@ -0,0 +1,23 @@
+require 'spec_helper'
+
+describe Arel::Nodes::SelectCore do
+ describe "#clone" do
+ it "clones froms, projections and wheres" do
+ core = Arel::Nodes::SelectCore.new
+ core.instance_variable_set "@froms", %w[a b c]
+ core.instance_variable_set "@projections", %w[d e f]
+ core.instance_variable_set "@wheres", %w[g h i]
+
+ [:froms, :projections, :wheres].each do |array_attr|
+ core.send(array_attr).each_with_index do |o, j|
+ o.should_receive(:clone).and_return("#{o}#{j}")
+ end
+ end
+
+ dolly = core.clone
+ dolly.froms.should == %w[a0 b1 c2]
+ dolly.projections.should == %w[d0 e1 f2]
+ dolly.wheres.should == %w[g0 h1 i2]
+ end
+ end
+end