From 346d9c6bde5ae0a0c918b4e0b25d79aa2760234a Mon Sep 17 00:00:00 2001 From: Nick Kallen Date: Sat, 5 Jan 2008 13:00:39 -0800 Subject: basic rename functionality --- spec/relations/attribute_spec.rb | 6 ++++++ spec/relations/relation_spec.rb | 6 ++++++ spec/relations/table_relation_spec.rb | 24 ++++++++++++++++-------- 3 files changed, 28 insertions(+), 8 deletions(-) (limited to 'spec/relations') diff --git a/spec/relations/attribute_spec.rb b/spec/relations/attribute_spec.rb index d8a007f918..7015fd2542 100644 --- a/spec/relations/attribute_spec.rb +++ b/spec/relations/attribute_spec.rb @@ -6,6 +6,12 @@ describe Attribute do @relation2 = TableRelation.new(:bar) end + describe 'aliaz' do + it "manufactures an aliased attributed" do + pending + end + end + describe '#eql?' do it "obtains if the relation and attribute name are identical" do Attribute.new(@relation1, :attribute_name).should be_eql(Attribute.new(@relation1, :attribute_name)) diff --git a/spec/relations/relation_spec.rb b/spec/relations/relation_spec.rb index db4b6b8775..5cef7d7b3d 100644 --- a/spec/relations/relation_spec.rb +++ b/spec/relations/relation_spec.rb @@ -48,6 +48,12 @@ describe Relation do end end + describe Relation, '#rename' do + it "manufactures a rename relation" do + @relation1.rename(@attribute1, :foo).should == RenameRelation.new(@relation1, @attribute1, :foo) + end + end + describe Relation, '#select' do before do @predicate = EqualityPredicate.new(@attribute1, @attribute2) diff --git a/spec/relations/table_relation_spec.rb b/spec/relations/table_relation_spec.rb index 8cd31a9ac8..dec8bba6b1 100644 --- a/spec/relations/table_relation_spec.rb +++ b/spec/relations/table_relation_spec.rb @@ -1,13 +1,21 @@ require File.join(File.dirname(__FILE__), '..', 'spec_helper') -describe TableRelation, '#to_sql' do - it "returns a simple SELECT query" do - TableRelation.new(:users).to_sql.should == SelectBuilder.new do |s| - select do - column :users, :name - column :users, :id +describe TableRelation do + describe '#to_sql' do + it "returns a simple SELECT query" do + TableRelation.new(:users).to_sql.should == SelectBuilder.new do |s| + select do + column :users, :name + column :users, :id + end + from :users end - from :users end end -end + + describe '#attributes' do + it 'manufactures attributes corresponding to columns in the table' do + pending + end + end +end \ No newline at end of file -- cgit v1.2.3