Updated

spec/lib / arel_extensions_spec.rb

B
21 lines of codes
0 methods
N/A complexity/method
1 churn
36.66 complexity
38 duplications
require 'rails_helper' RSpec.describe "Arel array predicates" do let(:column) { Petition.arel_table[:tags] } describe "#contains" do
  1. Similar code found in 2 nodes Locations: 0 1
subject { column.contains([1]) } it "generates the correct SQL" do expect(subject.to_sql).to eq(%["petitions"."tags" @> '{1}']) end end describe "#overlaps" do
  1. Similar code found in 2 nodes Locations: 0 1
subject { column.overlaps([1]) } it "generates the correct SQL" do expect(subject.to_sql).to eq(%["petitions"."tags" && '{1}']) end end end