Sha256: 879729e16e366024ee082534d8f2c7196440d076056d330c2320a2b0db8fe294
Contents?: true
Size: 1.04 KB
Versions: 3
Compression:
Stored size: 1.04 KB
Contents
require File.expand_path('../../helper', __FILE__) describe ActiveRecord::QueryMethods::WhereChain do describe :not_like do it "creates an Arel DoesNotMatch node in the relation" do relation = Post.where.not_like(title: '') relation.where_clause.send(:predicates).first.must_be_instance_of(Arel::Nodes::DoesNotMatch) end describe "the Arel Node" do before do @attribute = "title" @value = '%value%' @relation = Post.where.like(@attribute => @value) @first_predicate = @relation.where_clause.send(:predicates).first end it "has the attribute as the left operand" do @first_predicate.left.name.must_equal @attribute end it "has the value as the right operand" do # Rails 5.0 & 5.1 first_bind = if @relation.where_clause.respond_to?(:binds) @relation.where_clause.send(:binds).first else # Rails 5.2 @first_predicate.right.value end first_bind.value.must_equal @value end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
activerecord-like-7.0.0 | test/unit/not_like_test.rb |
activerecord-like-6.1.0 | test/unit/not_like_test.rb |
activerecord-like-2.2 | test/unit/not_like_test.rb |