Sha256: 14f5afea8c37f910d2bcac751c348a966cd6cfc68b5eda4e78ebffd584ab7ee3
Contents?: true
Size: 1.7 KB
Versions: 1
Compression:
Stored size: 1.7 KB
Contents
require 'spec_helper' require 'everywhere/method' describe 'normal query' do before do @where = Post.where(:name => 'hello').where_values end subject { @where } it { @where.should have(1).item } subject { @where.first } its(:to_sql) { should == %q["posts"."name" = 'hello'] } end describe 'not' do describe 'not eq' do before do @where = Post.where_not(:name => 'hello').where_values end subject { @where } it { @where.should have(1).item } subject { @where.first } its(:to_sql) { should == %q["posts"."name" != 'hello'] } end describe 'not null' do before do @where = Post.where_not(:created_at => nil).where_values end subject { @where } it { @where.should have(1).item } subject { @where.first } its(:to_sql) { should == %q["posts"."created_at" IS NOT NULL] } end describe 'not in' do before do @where = Post.where_not(:name => %w[hello goodbye]).where_values end subject { @where } it { @where.should have(1).item } subject { @where.first } its(:to_sql) { should == %q["posts"."name" NOT IN ('hello', 'goodbye')] } end describe 'association' do before do @where = Post.joins(:comments).where_not(:comments => {:body => 'foo'}).where_values end subject { @where } it { @where.should have(1).item } subject { @where.first } its(:to_sql) { should == %q["comments"."body" != 'foo'] } end end describe 'like' do describe 'like match' do before do @where = Post.where_like(:title => 'he%').where_values end subject { @where } it { @where.should have(1).item } subject { @where.first } its(:to_sql) { should == %q["posts"."title" LIKE 'he%'] } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
everywhere-0.1.0 | spec/method_spec.rb |