A post about testing and then something about leiningen

I am writing this post in emacs tonight instead of the WordPress editor. I don’t know if it will make much difference, but I’ll keep it in markdown-mode for tonight.
I posted some questions about functional testing in rails. I am currently building what is most likely my most complicated rails application to date. I’ve been getting better at rails, but some of the things are still taking time to set in.
I’ve decided to really push the TDD aspect on this particular app. I am exploring using authlogic and declarative authorization to handle the security controls of the app. This is the kind of thing you want you want to be testing like crazy.
I’ve been having trouble with testing using loops to test access. One of the libraries uses a protected value that is only being set when a page is requested. I managed to log a user in, and that’s working quite well, but I’m having trouble logging that user out and a new user in within the same test case. I had this nice, elegant loop crafted that would allow me to establish a data structure that would allow me to control every aspect of the test. Alas, it would fail when it came time to change users. I put tons of debug code everywhere. I was hitting C-c ‘ r t <tab> <return> like crazy. I cleared everything that could even look like a bit of session. I couldn’t get Authorization.current_user to reflect the credentials of the current UserSession.
I do feel that I made up for it quite nicely. I managed to take about 3-4 lines of every test and pack it all into a single function that lets me specify the rules of the access check using a map. I’m quite happy with it
In clojure news. I’ve finally taken the plunge and have learned Leiningen. I was previously using Maven, so I’m not that hard of a sell. I like some of the ideas, but truthfully, I’m more interested in the polyglot maven project. I think it would be interesting if one or both of the projects could make it so they could try to read the other’s build files if available. So my first task was to take the clj-mql library, which I had just
checked out because I’m trying to learn more MQL, and convert the dependencies to maven. I hit a snag on something, and when I asked
about it in IRC, someone asked why I wasn’t just using lein.
So I threw out my pom.xml and made a project.clj for it.
Leiningen currently has a problem with it’s swank option which is causing src/ to not be on the path. You can always use the repl option
or the distasteful add-classpath option, but that will need to be fixed. Someone posted a horribly convoluted series of steps that I
attempted, but didn’t work for me.
Advertisement

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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

Follow

Get every new post delivered to your Inbox.