Testing and API

Hi,

I make some changes and pretend to make so more.

In this patch there's:
- tested the StatsController actions
- add respond_to json that was requested in issue #23

I hope that you can merge it, or send me a feed back

Thank you