Sha256: 6fe843d56de936c970d9363f635b68878acdb84023829da59eb73e58648e72f2

Contents?: true

Size: 788 Bytes

Versions: 6

Compression:

Stored size: 788 Bytes

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_values.first.must_be_instance_of(Arel::Nodes::DoesNotMatch)
    end

    describe "the Arel Node" do
      before do
        @attribute = "title"
        @value = '%value%'

        @relation_specifier = Post.where.not_like(@attribute => @value).where_values.first
      end

      it "has the attribute as the left operand" do
        @relation_specifier.left.name.must_equal @attribute
      end

      it "has the value as the right operand" do
        @relation_specifier.right.must_equal @value
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
activerecord-like-0.0.6 test/unit/not_like_test.rb
activerecord-like-0.0.5 test/unit/not_like_test.rb
activerecord-like-0.0.4 test/unit/not_like_test.rb
activerecord-like-0.0.3 test/unit/not_like_test.rb
activerecord-like-0.0.2 test/unit/not_like_test.rb
activerecord-like-0.0.1 test/unit/not_like_test.rb