aboutsummaryrefslogtreecommitdiffstats
path: root/spec/active_relation/relations/projection_spec.rb
diff options
context:
space:
mode:
authorBryan Helmkamp <bryan@brynary.com>2008-01-14 10:50:46 -0500
committerBryan Helmkamp <bryan@brynary.com>2008-01-14 10:50:46 -0500
commit553eb0ad490abc7f85d9836c3ba959ab771d3cf4 (patch)
treebaa9714465488d77980e8d252a82849b32844d3b /spec/active_relation/relations/projection_spec.rb
parent17a5fd13bc4ba8405d95e90d12b87dcd7e5bea5b (diff)
downloadrails-553eb0ad490abc7f85d9836c3ba959ab771d3cf4.tar.gz
rails-553eb0ad490abc7f85d9836c3ba959ab771d3cf4.tar.bz2
rails-553eb0ad490abc7f85d9836c3ba959ab771d3cf4.zip
Remove ActiveRelation sub-modules and refactor specs
Diffstat (limited to 'spec/active_relation/relations/projection_spec.rb')
-rw-r--r--spec/active_relation/relations/projection_spec.rb50
1 files changed, 26 insertions, 24 deletions
diff --git a/spec/active_relation/relations/projection_spec.rb b/spec/active_relation/relations/projection_spec.rb
index 6ffdeb8e09..8d6a093af2 100644
--- a/spec/active_relation/relations/projection_spec.rb
+++ b/spec/active_relation/relations/projection_spec.rb
@@ -1,34 +1,36 @@
require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper')
-describe ActiveRelation::Relations::Projection do
- before do
- @relation1 = ActiveRelation::Relations::Table.new(:foo)
- @relation2 = ActiveRelation::Relations::Table.new(:bar)
- @attribute1 = @relation1[:id]
- @attribute2 = @relation2[:id]
- end
+module ActiveRelation
+ describe Projection do
+ before do
+ @relation1 = Table.new(:foo)
+ @relation2 = Table.new(:bar)
+ @attribute1 = @relation1[:id]
+ @attribute2 = @relation2[:id]
+ end
- describe '==' do
- it "obtains if the relations and attributes are identical" do
- ActiveRelation::Relations::Projection.new(@relation1, @attribute1, @attribute2).should == ActiveRelation::Relations::Projection.new(@relation1, @attribute1, @attribute2)
- ActiveRelation::Relations::Projection.new(@relation1, @attribute1).should_not == ActiveRelation::Relations::Projection.new(@relation2, @attribute1)
- ActiveRelation::Relations::Projection.new(@relation1, @attribute1).should_not == ActiveRelation::Relations::Projection.new(@relation1, @attribute2)
+ describe '==' do
+ it "obtains if the relations and attributes are identical" do
+ Projection.new(@relation1, @attribute1, @attribute2).should == Projection.new(@relation1, @attribute1, @attribute2)
+ Projection.new(@relation1, @attribute1).should_not == Projection.new(@relation2, @attribute1)
+ Projection.new(@relation1, @attribute1).should_not == Projection.new(@relation1, @attribute2)
+ end
end
- end
- describe '#qualify' do
- it "distributes over the relation and attributes" do
- ActiveRelation::Relations::Projection.new(@relation1, @attribute1).qualify. \
- should == ActiveRelation::Relations::Projection.new(@relation1.qualify, @attribute1.qualify)
+ describe '#qualify' do
+ it "distributes over the relation and attributes" do
+ Projection.new(@relation1, @attribute1).qualify. \
+ should == Projection.new(@relation1.qualify, @attribute1.qualify)
+ end
end
- end
- describe '#to_sql' do
- it "manufactures sql with a limited select clause" do
- ActiveRelation::Relations::Projection.new(@relation1, @attribute1).to_sql.should be_like("""
- SELECT `foo`.`id`
- FROM `foo`
- """)
+ describe '#to_sql' do
+ it "manufactures sql with a limited select clause" do
+ Projection.new(@relation1, @attribute1).to_sql.should be_like("""
+ SELECT `foo`.`id`
+ FROM `foo`
+ """)
+ end
end
end
end \ No newline at end of file