diff options
author | Bryan Helmkamp <bryan@brynary.com> | 2008-01-14 10:50:46 -0500 |
---|---|---|
committer | Bryan Helmkamp <bryan@brynary.com> | 2008-01-14 10:50:46 -0500 |
commit | 553eb0ad490abc7f85d9836c3ba959ab771d3cf4 (patch) | |
tree | baa9714465488d77980e8d252a82849b32844d3b /spec/active_relation/relations/range_spec.rb | |
parent | 17a5fd13bc4ba8405d95e90d12b87dcd7e5bea5b (diff) | |
download | rails-553eb0ad490abc7f85d9836c3ba959ab771d3cf4.tar.gz rails-553eb0ad490abc7f85d9836c3ba959ab771d3cf4.tar.bz2 rails-553eb0ad490abc7f85d9836c3ba959ab771d3cf4.zip |
Remove ActiveRelation sub-modules and refactor specs
Diffstat (limited to 'spec/active_relation/relations/range_spec.rb')
-rw-r--r-- | spec/active_relation/relations/range_spec.rb | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/spec/active_relation/relations/range_spec.rb b/spec/active_relation/relations/range_spec.rb index d4107259aa..f417626fed 100644 --- a/spec/active_relation/relations/range_spec.rb +++ b/spec/active_relation/relations/range_spec.rb @@ -1,30 +1,31 @@ require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper') -describe ActiveRelation::Relations::Range do - before do - @relation1 = ActiveRelation::Relations::Table.new(:foo) - @relation2 = ActiveRelation::Relations::Table.new(:bar) - @range1 = 1..2 - @range2 = 4..9 - end +module ActiveRelation + describe Range do + before do + @relation1 = Table.new(:foo) + @relation2 = Table.new(:bar) + @range1 = 1..2 + @range2 = 4..9 + end - describe '#qualify' do - it "distributes over the relation and attributes" do - pending + describe '#qualify' do + it "distributes over the relation and attributes" do + pending + end end - end - describe '#to_sql' do - it "manufactures sql with limit and offset" do - range_size = @range2.last - @range2.first + 1 - range_start = @range2.first - ActiveRelation::Relations::Range.new(@relation1, @range2).to_s.should be_like(""" - SELECT `foo`.`name`, `foo`.`id` - FROM `foo` - LIMIT #{range_size} - OFFSET #{range_start} - """) + describe '#to_sql' do + it "manufactures sql with limit and offset" do + range_size = @range2.last - @range2.first + 1 + range_start = @range2.first + Range.new(@relation1, @range2).to_s.should be_like(""" + SELECT `foo`.`name`, `foo`.`id` + FROM `foo` + LIMIT #{range_size} + OFFSET #{range_start} + """) + end end end - end
\ No newline at end of file |