diff options
author | Mike Dalessio <mike@csa.net> | 2010-08-30 18:35:13 -0400 |
---|---|---|
committer | Mike Dalessio <mike@csa.net> | 2010-08-30 18:35:13 -0400 |
commit | 4e1dd7eeabde2bd785d47db895e45c11f1693c05 (patch) | |
tree | 4fe7931adea5681a15ac5feee3c504cce1ca021a /spec/arel/nodes | |
parent | dc750bef5cf5b577399c84f97b821af26c9554a2 (diff) | |
download | rails-4e1dd7eeabde2bd785d47db895e45c11f1693c05.tar.gz rails-4e1dd7eeabde2bd785d47db895e45c11f1693c05.tar.bz2 rails-4e1dd7eeabde2bd785d47db895e45c11f1693c05.zip |
deep copies of statements aren't necessary. shallow copy the top-level arrays.
Diffstat (limited to 'spec/arel/nodes')
-rw-r--r-- | spec/arel/nodes/delete_statement_spec.rb | 6 | ||||
-rw-r--r-- | spec/arel/nodes/insert_statement_spec.rb | 12 | ||||
-rw-r--r-- | spec/arel/nodes/select_core_spec.rb | 10 | ||||
-rw-r--r-- | spec/arel/nodes/select_statement_spec.rb | 6 | ||||
-rw-r--r-- | spec/arel/nodes/update_statement_spec.rb | 12 |
5 files changed, 16 insertions, 30 deletions
diff --git a/spec/arel/nodes/delete_statement_spec.rb b/spec/arel/nodes/delete_statement_spec.rb index 03fa41799a..4d12d184fb 100644 --- a/spec/arel/nodes/delete_statement_spec.rb +++ b/spec/arel/nodes/delete_statement_spec.rb @@ -6,12 +6,10 @@ describe Arel::Nodes::DeleteStatement do statement = Arel::Nodes::DeleteStatement.new statement.wheres = %w[a b c] - statement.wheres.each_with_index do |o, j| - o.should_receive(:clone).and_return("#{o}#{j}") - end + statement.wheres.should_receive(:clone).and_return([:wheres]) dolly = statement.clone - dolly.wheres.should == %w[a0 b1 c2] + dolly.wheres.should == [:wheres] end end end diff --git a/spec/arel/nodes/insert_statement_spec.rb b/spec/arel/nodes/insert_statement_spec.rb index 286a44130c..0e2432c021 100644 --- a/spec/arel/nodes/insert_statement_spec.rb +++ b/spec/arel/nodes/insert_statement_spec.rb @@ -7,16 +7,12 @@ describe Arel::Nodes::InsertStatement do statement.columns = %w[a b c] statement.values = %w[x y z] - statement.columns.each_with_index do |o, j| - o.should_receive(:clone).and_return("#{o}#{j}") - end - statement.values.each_with_index do |o, j| - o.should_receive(:clone).and_return("#{o}#{j}") - end + statement.columns.should_receive(:clone).and_return([:columns]) + statement.values.should_receive(:clone).and_return([:values]) dolly = statement.clone - check dolly.columns.should == %w[a0 b1 c2] - check dolly.values.should == %w[x0 y1 z2] + check dolly.columns.should == [:columns] + check dolly.values.should == [:values] end end end diff --git a/spec/arel/nodes/select_core_spec.rb b/spec/arel/nodes/select_core_spec.rb index 30927abea6..d2e87c2c23 100644 --- a/spec/arel/nodes/select_core_spec.rb +++ b/spec/arel/nodes/select_core_spec.rb @@ -9,15 +9,13 @@ describe Arel::Nodes::SelectCore do 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 + core.send(array_attr).should_receive(:clone).and_return([array_attr]) end dolly = core.clone - check dolly.froms.should == %w[a0 b1 c2] - check dolly.projections.should == %w[d0 e1 f2] - check dolly.wheres.should == %w[g0 h1 i2] + check dolly.froms.should == [:froms] + check dolly.projections.should == [:projections] + check dolly.wheres.should == [:wheres] end end end diff --git a/spec/arel/nodes/select_statement_spec.rb b/spec/arel/nodes/select_statement_spec.rb index a024710c78..75463f1d95 100644 --- a/spec/arel/nodes/select_statement_spec.rb +++ b/spec/arel/nodes/select_statement_spec.rb @@ -5,12 +5,10 @@ describe Arel::Nodes::SelectStatement do it "clones cores" do statement = Arel::Nodes::SelectStatement.new %w[a b c] - statement.cores.each_with_index do |o, j| - o.should_receive(:clone).and_return("#{o}#{j}") - end + statement.cores.should_receive(:clone).and_return([:cores]) dolly = statement.clone - dolly.cores.should == %w[a0 b1 c2] + dolly.cores.should == [:cores] end end end diff --git a/spec/arel/nodes/update_statement_spec.rb b/spec/arel/nodes/update_statement_spec.rb index 3d425e2843..860d1c448a 100644 --- a/spec/arel/nodes/update_statement_spec.rb +++ b/spec/arel/nodes/update_statement_spec.rb @@ -7,16 +7,12 @@ describe Arel::Nodes::UpdateStatement do statement.wheres = %w[a b c] statement.values = %w[x y z] - statement.wheres.each_with_index do |o, j| - o.should_receive(:clone).and_return("#{o}#{j}") - end - statement.values.each_with_index do |o, j| - o.should_receive(:clone).and_return("#{o}#{j}") - end + statement.wheres.should_receive(:clone).and_return([:wheres]) + statement.values.should_receive(:clone).and_return([:values]) dolly = statement.clone - check dolly.wheres.should == %w[a0 b1 c2] - check dolly.values.should == %w[x0 y1 z2] + check dolly.wheres.should == [:wheres] + check dolly.values.should == [:values] end end end |