egonSchiele / contracts.ruby

Contracts for Ruby.
http://egonschiele.github.com/contracts.ruby
BSD 2-Clause "Simplified" License
1.44k stars 82 forks source link

Fix StrictHash contract for extra keys #254

Closed smt116 closed 7 years ago

smt116 commented 7 years ago

Contracts::StrictHash didn't complain about extra entries in a given hash. This was because of the missing assertion for keys. Specs hadn't caught this case because age key had a wrong type anyway.

Compare keys for contract and a given hash and return false if they are equal.

egonSchiele commented 7 years ago

Thanks for this PR! I will check it shortly

smt116 commented 7 years ago

Fixed. I didn't touched 1.8.7 support as I saw that someone else wanted to do that (https://github.com/egonSchiele/contracts.ruby/pull/255#issuecomment-294505713).

egonSchiele commented 7 years ago

can you merge master into this branch? ci should pass, and then I'll merge

smt116 commented 7 years ago

@egonSchiele done.

egonSchiele commented 7 years ago

Thank you!