aboutsummaryrefslogtreecommitdiffstats
path: root/spec/arel/nodes/update_statement_spec.rb
blob: 3d425e28435b0d9a3ea80bbf9e133eaa279df0ce (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require 'spec_helper'

describe Arel::Nodes::UpdateStatement do
  describe "#clone" do
    it "clones wheres and values" do
      statement = Arel::Nodes::UpdateStatement.new
      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

      dolly = statement.clone
      check dolly.wheres.should == %w[a0 b1 c2]
      check dolly.values.should == %w[x0 y1 z2]
    end
  end
end