aboutsummaryrefslogtreecommitdiffstats
path: root/spec/relations/table_relation_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/relations/table_relation_spec.rb')
-rw-r--r--spec/relations/table_relation_spec.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/spec/relations/table_relation_spec.rb b/spec/relations/table_relation_spec.rb
index dec8bba6b1..0380372344 100644
--- a/spec/relations/table_relation_spec.rb
+++ b/spec/relations/table_relation_spec.rb
@@ -1,9 +1,13 @@
require File.join(File.dirname(__FILE__), '..', 'spec_helper')
describe TableRelation do
+ before do
+ @relation = TableRelation.new(:users)
+ end
+
describe '#to_sql' do
it "returns a simple SELECT query" do
- TableRelation.new(:users).to_sql.should == SelectBuilder.new do |s|
+ @relation.to_sql.should == SelectBuilder.new do |s|
select do
column :users, :name
column :users, :id
@@ -18,4 +22,12 @@ describe TableRelation do
pending
end
end
+
+ describe '#qualify' do
+ it 'manufactures a rename relation with all attribute names qualified' do
+ @relation.qualify.should == RenameRelation.new(
+ RenameRelation.new(@relation, @relation[:id] => 'users.id'), @relation[:name] => 'users.name'
+ )
+ end
+ end
end \ No newline at end of file