diff options
author | Carl Lerche <carllerche@mac.com> | 2010-03-12 15:25:21 -0800 |
---|---|---|
committer | Carl Lerche <carllerche@mac.com> | 2010-03-12 15:25:21 -0800 |
commit | 0e6888232a19c8c59416490d3da6079e590fab77 (patch) | |
tree | 43f5157375fdcfb449f245f43dcddabd29208243 /spec | |
parent | e13420c86afb5c31e90cff800f121bd49255b939 (diff) | |
download | rails-0e6888232a19c8c59416490d3da6079e590fab77.tar.gz rails-0e6888232a19c8c59416490d3da6079e590fab77.tar.bz2 rails-0e6888232a19c8c59416490d3da6079e590fab77.zip |
Add support for a NOT predicate
Diffstat (limited to 'spec')
-rw-r--r-- | spec/algebra/integration/basic_spec.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/algebra/integration/basic_spec.rb b/spec/algebra/integration/basic_spec.rb index 7aa4f7305c..e48f94625d 100644 --- a/spec/algebra/integration/basic_spec.rb +++ b/spec/algebra/integration/basic_spec.rb @@ -49,6 +49,39 @@ share_examples_for 'A Relation' do expected = @expected.select { |r| r[@relation[:age]] == @pivot[@relation[:age]] } @relation.where(@relation[:age].eq(@pivot[@relation[:age]])).should have_rows(expected) end + + it "finds rows with a not predicate" do + expected = @expected.select { |r| r[@relation[:age]] != @pivot[@relation[:age]] } + @relation.where(@relation[:age].not(@pivot[@relation[:age]])).should have_rows(expected) + end + + it "finds rows with a less than predicate" do + expected = @expected.select { |r| r[@relation[:age]] < @pivot[@relation[:age]] } + @relation.where(@relation[:age].lt(@pivot[@relation[:age]])).should have_rows(expected) + end + + it "finds rows with a less than or equal to predicate" do + expected = @expected.select { |r| r[@relation[:age]] <= @pivot[@relation[:age]] } + @relation.where(@relation[:age].lteq(@pivot[@relation[:age]])).should have_rows(expected) + end + + it "finds rows with a greater than predicate" do + expected = @expected.select { |r| r[@relation[:age]] > @pivot[@relation[:age]] } + @relation.where(@relation[:age].gt(@pivot[@relation[:age]])).should have_rows(expected) + end + + it "finds rows with a greater than or equal to predicate" do + expected = @expected.select { |r| r[@relation[:age]] >= @pivot[@relation[:age]] } + @relation.where(@relation[:age].gteq(@pivot[@relation[:age]])).should have_rows(expected) + end + + it "finds rows with a matches predicate" + + it "finds rows with an in predicate" do + pending + set = @expected[1..(@expected.length/2+1)] + @relation.all(:id.in => set.map { |r| r.id }).should have_resources(set) + end end end |