vonkanehoffen/Draww — pull request #2 by Robsteranium (2011-12-15 00:19:15+00:00)
Title: installed rspec.  specced ranking mechanism

Hey dood.

I've created a branch with some specifications for the ranking mechanism.
http://book.git-scm.com/3_basic_branching_and_merging.html
https://github.com/rspec/rspec-rails
https://www.relishapp.com/rspec/rspec-rails
https://github.com/thoughtbot/factory_girl

Basically, once you've ```bundle install```d, you should be able to run ```rspec spec/ranking_spec.rb``` to run the tests. The idea is:
1. Write specs (i.e. the ones I'm committing)
2. Run specs and watch them fail
2. Do the least possible to fulfil them
3. Repeat 2 until all specs pass

You should be able to get most of them passing by creating and associating a Vote model and defining methods for totals and scores. Although the following is hardly what we're aiming for eventually, it will at least allow some tests to pass.

class User
def score
0
end
end

Clearly this will need to be replaced later with a method like ```posts.map(&:total_votes).sum```. The point is that you only need worry about that when the spec requires it. Indeed we may need to spec out "user weighting" before we get to a ranking mechanism like the one we discussed.

CSS looks neat btw.