Sha256: 8ff58ad746e024fef28109618a484180ad9cf996c31506f6b122e7fa6cd6377b

Contents?: true

Size: 489 Bytes

Versions: 4

Compression:

Stored size: 489 Bytes

Contents

require "spec_helper"

describe Parelation::Criteria::Select do

  let(:klass) { Parelation::Criteria::Select }

  it "should match" do
    expect(klass.match?("select")).to eq(true)
  end

  it "should not match" do
    expect(klass.match?("query")).to eq(false)
  end

  it "should add criteria to the chain" do
    criteria = klass.new(Ticket.all, "select", ["id", "name"]).call
    ar_query = Ticket.all.select(:id, :name)

    expect(criteria.to_sql).to eq(ar_query.to_sql)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
parelation-1.0.0 spec/lib/criteria/select_spec.rb
parelation-0.2.0 spec/lib/criteria/select_spec.rb
parelation-0.1.0 spec/lib/criteria/select_spec.rb
parelation-0.0.1 spec/lib/criteria/select_spec.rb