Added Rubocop, upgraded RSpec and fixed has_lock?

* Added rubocop to enforce ruby style.
* Upgraded RSpec to 3.x expectations.
* The `has_lock?` method returns a `nil` instead of `false` in some tests. Now we compare to `false` explicitly.
Same question as above.