spec/hash_key_spec.rb in everywhere-0.0.1 vs spec/hash_key_spec.rb in everywhere-0.1.0
- old
+ new
@@ -9,44 +9,58 @@
it { @where.should have(1).item }
subject { @where.first }
its(:to_sql) { should == %q["posts"."title" = 'hello'] }
end
-describe 'not eq' do
- before do
- @where = Post.where(:not => {:title => 'hello'}).where_values
+describe 'not' do
+ describe 'not eq' do
+ before do
+ @where = Post.where(:not => {:title => 'hello'}).where_values
+ end
+ subject { @where }
+ it { @where.should have(1).item }
+ subject { @where.first }
+ its(:to_sql) { should == %q["posts"."title" != 'hello'] }
end
- subject { @where }
- it { @where.should have(1).item }
- subject { @where.first }
- its(:to_sql) { should == %q["posts"."title" != 'hello'] }
-end
-describe 'not null' do
- before do
- @where = Post.where(:not => {:created_at => nil}).where_values
+ 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
- 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 => {:title => %w[hello goodbye]}).where_values
+ describe 'not in' do
+ before do
+ @where = Post.where(:not => {:title => %w[hello goodbye]}).where_values
+ end
+ subject { @where }
+ it { @where.should have(1).item }
+ subject { @where.first }
+ its(:to_sql) { should == %q["posts"."title" NOT IN ('hello', 'goodbye')] }
end
- subject { @where }
- it { @where.should have(1).item }
- subject { @where.first }
- its(:to_sql) { should == %q["posts"."title" NOT IN ('hello', 'goodbye')] }
+
+ describe 'association' do
+ before do
+ @where = Post.joins(:comments).where(:comments => {:not => {: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 'association' do
- before do
- @where = Post.joins(:comments).where(:comments => {:not => {:body => 'foo'}}).where_values
+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
- subject { @where }
- it { @where.should have(1).item }
- subject { @where.first }
- its(:to_sql) { should == %q["comments"."body" != 'foo'] }
end