blob: d2e87c2c230046571b142c7dec48fae7f9b201d7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
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).should_receive(:clone).and_return([array_attr])
end
dolly = core.clone
check dolly.froms.should == [:froms]
check dolly.projections.should == [:projections]
check dolly.wheres.should == [:wheres]
end
end
end
|