aboutsummaryrefslogtreecommitdiffstats
path: root/spec/engines/memory/unit/relations/project_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/engines/memory/unit/relations/project_spec.rb')
-rw-r--r--spec/engines/memory/unit/relations/project_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/engines/memory/unit/relations/project_spec.rb b/spec/engines/memory/unit/relations/project_spec.rb
new file mode 100644
index 0000000000..92ed9fa74b
--- /dev/null
+++ b/spec/engines/memory/unit/relations/project_spec.rb
@@ -0,0 +1,27 @@
+require 'spec_helper'
+
+module Arel
+ describe Project do
+ before do
+ @relation = Array.new([
+ [1, 'duck' ],
+ [2, 'duck' ],
+ [3, 'goose']
+ ], [[:id, Attributes::Integer], [:name, Attributes::String]])
+ end
+
+ describe '#call' do
+ it 'retains only the attributes that are provided' do
+ @relation \
+ .project(@relation[:id]) \
+ .let do |relation|
+ relation.call.should == [
+ Row.new(relation, [1]),
+ Row.new(relation, [2]),
+ Row.new(relation, [3])
+ ]
+ end
+ end
+ end
+ end
+end