Add regression spec for #496 and update changelog.

Follow-up to previous commit a3d6f2c.
This commit is contained in:
jonatack 2015-01-21 13:03:29 +01:00
parent a3d6f2c616
commit 4018ac0053
2 changed files with 24 additions and 0 deletions

View File

@ -1,5 +1,17 @@
# Change Log
## Master (unreleased)
* Fix a regression
([#496](https://github.com/activerecord-hackery/ransack/issues/496)) caused
by [ee571fe](https://github.com/activerecord-hackery/ransack/commit/ee571fe)
where passing a multi-parameter attribute (i.e. `date_select`) raised
`RuntimeError: can't add a new key into hash during iteration`, and add a
regression spec for the issue.
*Nate Berkopec*, *Jon Atack*
## Version 1.6.2 - 2015-01-14
* Fix a regression

View File

@ -152,6 +152,18 @@ module Ransack
s = Person.ransack('')
end
it "should function correctly with a multi-parameter attribute" do
date = Date.current
s = Person.ransack(
{ "created_at_gteq(1i)" => date.year,
"created_at_gteq(2i)" => date.month,
"created_at_gteq(3i)" => date.day
}
)
expect(s.result.to_sql).to match />=/
expect(s.result.to_sql).to match date.to_s
end
it "should function correctly when using fields with dots in them" do
s = Person.ransack(:email_cont => "example.com")
expect(s.result.exists?).to be true