Skip to content

Commit 5eb3e60

Browse files
authored
MONGOID-5359 test regexes should work on symbol fields (#5415)
1 parent 8611d9a commit 5eb3e60

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

spec/mongoid/criteria_spec.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3126,6 +3126,19 @@ def self.ages; self; end
31263126
end
31273127
end
31283128
end
3129+
3130+
context "when searching for a regex on a symbol field" do
3131+
let!(:person) { Person.create!(species: :hello)}
3132+
let(:criteria) { Person.where(species: /ell/) }
3133+
3134+
it "creates the correct criteria" do
3135+
expect(criteria.selector).to eq({ "species" => /ell/ })
3136+
end
3137+
3138+
it "finds the document" do
3139+
expect(criteria.first).to eq(person)
3140+
end
3141+
end
31293142
end
31303143

31313144
describe "#for_js" do

0 commit comments

Comments
 (0)