diff options
author | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-02-11 22:56:12 -0800 |
---|---|---|
committer | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-02-11 22:56:12 -0800 |
commit | 29d9b8e9b5899a8c52326dfca9343e79ba049d6b (patch) | |
tree | 4ca2605f94ca0d38d8aec1d689ec03713db54996 /spec/active_relation/relations/order_spec.rb | |
parent | 61d6c2c1c5215014971355892e024682ed148ebb (diff) | |
download | rails-29d9b8e9b5899a8c52326dfca9343e79ba049d6b.tar.gz rails-29d9b8e9b5899a8c52326dfca9343e79ba049d6b.tar.bz2 rails-29d9b8e9b5899a8c52326dfca9343e79ba049d6b.zip |
removing code complexity concerning attribute lookup.
Diffstat (limited to 'spec/active_relation/relations/order_spec.rb')
-rw-r--r-- | spec/active_relation/relations/order_spec.rb | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/spec/active_relation/relations/order_spec.rb b/spec/active_relation/relations/order_spec.rb index 204558daec..12b9761431 100644 --- a/spec/active_relation/relations/order_spec.rb +++ b/spec/active_relation/relations/order_spec.rb @@ -3,25 +3,23 @@ require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper') module ActiveRelation describe Order do before do - @relation1 = Table.new(:foo) - @relation2 = Table.new(:bar) - @attribute1 = @relation1[:id] - @attribute2 = @relation2[:id] + @relation = Table.new(:users) + @attribute = @relation[:id] end describe '#qualify' do it "distributes over the relation and attributes" do - Order.new(@relation1, @attribute1).qualify. \ - should == Order.new(@relation1.qualify, @attribute1.qualify) + Order.new(@relation, @attribute).qualify. \ + should == Order.new(@relation.qualify, @attribute.qualify) end end describe '#to_sql' do it "manufactures sql with an order clause" do - Order.new(@relation1, @attribute1).to_sql.should be_like(""" - SELECT `foo`.`name`, `foo`.`id` - FROM `foo` - ORDER BY `foo`.`id` + Order.new(@relation, @attribute).to_sql.should be_like(""" + SELECT `users`.`id`, `users`.`name` + FROM `users` + ORDER BY `users`.`id` """) end end |