jaceklaskowski / librarian-clojure

Book manager in Clojure
http://librarian-clojure.herokuapp.com/
22 stars 4 forks source link

Test for librarian-clojure.core use cases #26

Open jaceklaskowski opened 11 years ago

jaceklaskowski commented 11 years ago

Tests for the following use cases (guess they should be separate issues - create ones if you think so):

zoldar commented 11 years ago

I've took the opportunity to start fiddling with midje on that issue but I'm not sure if I understand it right - what one is supposed to test? When I take pure request/response check approach (as in case of existing tests), there's no distinction between login as user and login as admin when it comes to the outcome. In both cases the response is simple {:successful true}. The same with logout. Maybe what you meant is a sort of a full-blown selenium driven test?

jaceklaskowski commented 11 years ago

I don't want anybody to get burried setting up a test infrastructure for the project. The tests should be as simple as possible and let us introduce changes without worrying they break the project.

The tests should've been written before writing the code, but in this particular case it's gonna be different only when the tests deserve existence. If you think the tests are not necessary, mark the issue to be closed. It was just an idea to have more tests so others could join writing tests if they think that's the way to get involved.

What do you think?

zoldar commented 11 years ago

Going through history, I've realized that these tests (at least these in core) mainly conern routing, not the business logic. I'll try to look into that. I'm still struggling with proper testing (not only in clojure) so this will be an opportunity for me to do some sharpening in that aspect. Marick's way of doing TDD (as in his example tutorial on that game logic design) with Midje really feels right to me - maybe because of that strongly declarative approach.

jaceklaskowski commented 11 years ago

Can't wait till I see new tests coming in. Don't let me wait too long :-)

zoldar commented 11 years ago

Thought I would write some tests but I see that you're doing some cleaning up and test-related changes. Should I restrain from doing anything in that regard for now?

jaceklaskowski commented 11 years ago

Do it now. I'm finished for today. Use lein2 midje --lazytest while midje'ing as it will automatically execute the tests changed. Pull request once done (I spent a couple of hours trying to squash some autorization-related test issues, but couldn't get passed a line where response is supposed to be available - it's been nil)

zoldar commented 11 years ago

Just by the way (and sorry for off-topic) - "Create account" still doesn't bring up any overlay/dialog. Is that a problem awaiting for a fix or should it behave correctly by now?

jaceklaskowski commented 11 years ago

Needs a fix...and more importantly a test before an implementation :-) Everything's in the repo.