aboutsummaryrefslogtreecommitdiffstats
path: root/spec/arel/unit/relations/array_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/arel/unit/relations/array_spec.rb')
-rw-r--r--spec/arel/unit/relations/array_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/arel/unit/relations/array_spec.rb b/spec/arel/unit/relations/array_spec.rb
new file mode 100644
index 0000000000..1330f0f205
--- /dev/null
+++ b/spec/arel/unit/relations/array_spec.rb
@@ -0,0 +1,27 @@
+require File.join(File.dirname(__FILE__), '..', '..', '..', 'spec_helper')
+
+module Arel
+ describe Array do
+ before do
+ @relation = Array.new([[1], [2], [3]], [:id])
+ end
+
+ describe '#attributes' do
+ it 'manufactures attributes corresponding to the names given on construction' do
+ @relation.attributes.should == [
+ Attribute.new(@relation, :id)
+ ]
+ end
+ end
+
+ describe '#call' do
+ it "manufactures an array of hashes of attributes to values" do
+ @relation.call.should == [
+ { @relation[:id] => 1 },
+ { @relation[:id] => 2 },
+ { @relation[:id] => 3 }
+ ]
+ end
+ end
+ end
+end \ No newline at end of file