grocer/grocer — pull request #73 by petergoldstein (2014-01-13 02:41:56+00:00)
Title: RSpec 3.0.x syntax changes, fix exposed broken specs

1. Ran transpec to convert to RSpec 3.0.x syntax.
2. Fixed two specs which were only passing because of invalid syntax.

Running transpec exposed two specs which were only passing because of syntax errors in the original spec. As an example, this spec:

-> { described_class.new(invalid_binary_tuple) }.should
raise_error(Grocer::InvalidFormatError)

does not actually test whether a Grocer::InvalidFormatError is raised. Instead the 'should' takes no argument, which ensures it always passes. And the raise_error is called on the spec itself, and does not fail the spec.

Unfortunately String.unpack is a lot more forgiving than I think the original author thought - essentially if you pass a long enough String to String.unpack, it will decode into something. So the only way to trigger the Grocer::InvalidFormatError is if the argument string is too short for the unpacked representation.