potraznja > trebam | pounuda > poklanjam
add default rake task
use zeus
remove integration tests from unit test for user
add unit tests for ad
order of magnitude faster unit tests

We <3 TDD!

It means you write tests before you write code. It means you run unit
tests before you make any change. It means slow tests slow you down and
might even do you harm. If they're slow it's a pain to run them.

A test is a unit test if it tests something in an isolation.

A test touching a DB is an integration test.
A test requiring ActiveRecord is an integration test.
A test requiring Rails is an integration test.

A test requiring only a class that encapsulates your business logic is a
unit test.

Each of your unit tests should be independent. Order should not matter.
Isolation encourages focus.

10 seconds wait for unit tests is UNACCEPTABLE!

Unit tests should be:
* Thorough
* Stable
* Fast
* Few

What have I done:

* removed dependency on spec_helper which loads up the Rails env, which
  which adds about 10s to any test that's being ran
* removed dependency on Rails env from rake test task, so you can run
  all unit tests with `rake test` in a blink of an eye
* removed pending unit tests because they only require spec_helper and
  therefore just add to the boot time
* externalized business logic into modules located in /lib/extensions

"Give me some numbers already!"

Before:

   $ time rspec spec/models
   rspec spec/models  8.10s user 0.58s system 57% cpu 14.982 total

After:

   $ time rspec spec/models
   rspec spec/models  0.44s user 0.05s system 99% cpu 0.500 total

So basically, tests are 30 times faster now.

I'm not pulling all these arguments out of thin air. Here are the
resources:

* Sandi Metz - Magic Tricks for Testing : https://speakerdeck.com/skmetz/magic-tricks-of-testing-railsconf
* Sandi Metz - Solid Object Oriented Design : https://speakerdeck.com/skmetz/solid-object-oriented-design
* Avdi Grimm - Objects on Rails : http://objectsonrails.com/
* Corey Haines - Fast Rails Tests : http://arrrrcamp.be/videos/corey-haines/fast-rails-tests
* Tom Clemens - 4 Steps to Faster Rails Tests : http://tom-clements.com/blog/2011/10/23/4-steps-to-faster-rails-tests/

Enjoy fast tests!
prettify rspec output
add delegation test for ad
Rakefile should remain slow
add ad_creation service tests
Merge branch 'fast-tests' into dev