1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/spec/relations/table_relation_spec.rb
2008-01-05 15:24:46 -08:00

33 lines
No EOL
831 B
Ruby

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
@relation.to_sql.should == SelectBuilder.new do |s|
select do
column :users, :name
column :users, :id
end
from :users
end
end
end
describe '#attributes' do
it 'manufactures attributes corresponding to columns in the table' 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