Sha256: cffe56fea2e7169c216459f48a3d1c55afda27411282f93c0d87a3cd00aca7b7

Contents?: true

Size: 653 Bytes

Versions: 1

Compression:

Stored size: 653 Bytes

Contents

require File.expand_path('../../helper', __FILE__)

describe ActiveRecord::QueryMethods::WhereChain do
  describe :like do
    it "creates an Arel Matches node in the relation" do
      relation = Post.where.like(title: '')

      relation.where_values.first.must_be_instance_of(Arel::Nodes::Matches)
    end

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

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activerecord-like-1.0.0 test/unit/like_test.rb