Donebox is open source

When I previously announced my last project, some people asked that I open Donebox code.

svn co donebox

Or check it out on my code site with all the other useless stuff in there.

Patches are welcome and might be deployed to the live site.



Filed under Misc

9 responses to “Donebox is open source

  1. I took a quick look at the source and have to say I’m quite impressed with the quality of the code.

    I have one small question related to the tests. Do you ever write test for the views or the generated HTML?

  2. Thanks a lot J-F!

    I never write test to assert that some text or specific element is on a page, like:

    assert_select "li>ul#post_1"

    Because I think this removes the agility from the views. Breaking the tests just because you change some style in a view seems not logical to me. Ratter I encapsulate the more possible logic in the models, model extensions and helpers and test them. And functional tests actually renders the template, so the views code is tested. But not the rendered HTML, which would require a rendered/browser to instantiate the DOM.

    I sometimes write test for the js too with the javascript_test plugin. But I’m definitely not doing TDD with js because of all the x-browser issues.

    I’ve used Selenium on a couple of projects for system tests, but because it’s such a pain to maintain, run and install, I try to avoid it as much as possible unless necessary.

    Do you test your views in any other way J-F?

  3. “And functional tests actually renders the template, so the views code is tested.”

    The template does get rendered, but you don’t know if it is the “correct” html that you wanted. But I agree, view tests tend to be very brittle and a pain to maintain. It is better as you say to encapsulate logic in other places. I just have this nagging feeling that I’m missing something with my tests, which is why I looked at your code and asked if you normally test your views more explicitly.

    I tried Selenium once, but couldn’t get a very simple test to pass all the time. It would fail half the time for reasons I did not understand.

    I have not started testing my javascript. How do you deal with x-browser issues using something like javascript_test?

  4. i am impressed too by the code, as it’s not a commercial app. you got very good habits

  5. @jf what you mean by “correct” html ? And javascript_test is for unit testing your javascript. Tests are written in a HTML file and you can run them through rake. It will run on all installed browserd on your machine.

    @heri thanks a lot Heri, what habits are you talking about, writing tests ?

  6. What I mean by “correct” is, let’s say you have a form, are all the fields needed there, when you post it and there’s an error, do the values get put back in the field and the field with the error highlighted. Maybe that’s not a good example as the helpers probably have unit test for these.

    There are lot of errors that could happen in your html that won’t raise an exception and won’t be catched by the test.

    I agree with Heri about the habits. Writing test is one. Continuously refactoring could be another, making methods short, choosing good variable names, etc. I think I just got an idea for a good “top ten” post on my blog. 😉

  7. Yeah the values will be put back in the field as this is only HTML posted in a single request, you just test the HTML as if it’s plain text.

    The problem is with AJAX calls updating the page, then only the DOM is updated, not the HTML. You need a rendering engine to test this.

  8. Hi Mac 🙂

    I got inspired by the way you build your application. I post some code if you ever want to retrieve the task part from the chronic parsed string. It works for me.

    Feel free to improve it and post it back.

  9. Holy shit Philippe!

    that’s freaking nice! I had a task on my Donebox to improvide this acctualy, but couldn’t find a way.

    Thanks a lot, I’ll integrate this in donebox as soon as I get time!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s