Fix for #1451

Line codec was using an undefined variable which caused it to throw an exception.

Fixed and added tests for line codecs

Closes #1451
We should also verify that on_event is called. With the way this test is written, it will pass even if `on_event` is never invoked.

Something like:

```
count = 0
subject.on_event do |d|
  count += 1
  ...
end
subject.encode(event)
insist { count } == 1
```