schneems/Likeable — pull request #17 by leehambley (2012-03-02 22:46:20+00:00)
Title: Improved specs

The commit message says it all, this part of my work on merging @amrnt's work.

Improve the specs.

Improve the specs by running 30, of the 34 against a `NullRedis`
instance, a class with all methods returning a `NullObject`. This change
found two places where assumptions were being made, without being
mocked/stubbed correctly ("should not like by default", for example)

The two places that were making assumptions about the starting state
have now recieved explicit mocks/expectations to make clear the test
intention.

Added an `:integration` option to the specs which really need to talk to
Redis, there are 4 of these. The new real-redis has been re-implemented
as a Singleton class in `spec_helper.rb` where it is guaranteed to be
shut down by installing an `at_exit { }` block. This implementation is
mostly re-factored from the original.

The RSpec configuration has been cleaned-up, the `build_user!`,
`unload_user!` and related methods have been moved into a module, and
are available inside the RSpec scope.

The implementation of `CleanTestClassForLikeable` has been consolidated
from two similar (also **Setup**`CleanTestClassForLikeable`)
implementations in two different spec files, into one canonical
implementation in the spec helper.

The `Rakefile` is modified so that `rake` now defaults to running the
specs asif one had typed `rake spec`.