Skip to content

Commit

Permalink
Only run case-sensitive option spec when DB is postgres
Browse files Browse the repository at this point in the history
  • Loading branch information
shioyama committed May 28, 2018
1 parent dd4fd46 commit 8416210
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions spec/support/shared_examples/querying_examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -410,13 +410,15 @@ def query(*args, &block); model_class.i18n(*args, &block); end
expect(query { __send__(a1).matches("%foo") }).to match_array([i[0], *i[5..6], barfoo])
end

it "works with case_sensitive option" do
foobar = model_class.create(a1 => "foObar")
barfoo = model_class.create(a1 => "barfOo")
expect(query { __send__(a1).matches("foo%", nil, true) }).not_to include(foobar)
expect(query { __send__(a1).matches("foO%", nil, true) }).to include(foobar)
expect(query { __send__(a1).matches("%foo", nil, true) }).not_to include(barfoo)
expect(query { __send__(a1).matches("%fOo", nil, true) }).to include(barfoo)
if ENV['DB'] == 'postgres'
it "works with case_sensitive option" do
foobar = model_class.create(a1 => "foObar")
barfoo = model_class.create(a1 => "barfOo")
expect(query { __send__(a1).matches("foo%", nil, true) }).not_to include(foobar)
expect(query { __send__(a1).matches("foO%", nil, true) }).to include(foobar)
expect(query { __send__(a1).matches("%foo", nil, true) }).not_to include(barfoo)
expect(query { __send__(a1).matches("%fOo", nil, true) }).to include(barfoo)
end
end
end

Expand Down

0 comments on commit 8416210

Please sign in to comment.