Three weeks down, and I’ve been writing a lot of tests for GlitterGallery lately. I’ll have to admit I wouldn’t have gotten up to speed so easily had my mentor not bought me a copy of Everyday Rails Testing with Rspec (Yay!) 🙂 I’ve been silently telling myself – if I ever happen to write a technical book, it would be written like that. It’s really concise, to-the-point, and does it’s job.
Being new to BDD, there’s a habit I would like to form now – draw on paper first, describe behaviors in pencil, then move to writing the tests, and only then, code. This is the approach that seems to work best for me, although I only realized it late this week.
TODO status for week3:
Tests for User model Tests for blogging system Tests for comment system
- Tests for OpenID auth
Analysis of following-users strategy Analysis of relationship between User, Project and Glimage Analysis of relationship between Comment and models that will use it.
Here’s the initial set of ideas I’ve come up with to refer to for the following week:
- Emily and I have decided to stick to just OpenID for authentication now and replace the previous authentication strategy completely. So far my plan is to use omniauth on top of devise for authenticating, although that may change if I find easier documentation for playing around with another auth system. This also shows that documentation is really important when one is making software.
- Using OpenID would mean we will now just ask for the OpenID uri. Essential things like email and username will be fetched from the User’s OpenID provider, and if there happens to be an attribute that we’re not permitted to use, we’ll direct the user to another page where she enters the remaining details. Fedora contributors can use their FAS account to login by entering username.id.fedoraproject.org as their uri, although if there are plans to make a custom Fedora-only version of Glittery, enabling users to sign in using just the username shouldn’t be difficult at all.
- User model
- Largely, there won’t be a lot of changes right away until I dedicate some time to work on a User edit profile page. Until then, we’ll stick to attributes for username, email, openid_uri and a photo. I’m still not sure if we should continue using Gravatars, although I don’t see a reason why not.
- Lots of changes slated. First of all, the idea of allowing public users (read non-signed-in) to comment is a bad one, because anyone could pose as me, use my gravatar, and throw in a fancy comment. I’ll replace this completely to allow just signed-in users to comment, and we’ll make use of their user_id to fetch the rest of the user details. No more need to ask for author and email info any more.
- Comments will now be polymorphic to be used with more models. It’s not the best idea to use it just with glimages, because projects, glitterposts, and newer models would need them to. I’ve already changed the db/schema, but need to make it work – it breaks right now.
- This is a new feature. While its actual need is debatable, I think it’s convenient to let the users maintain a blogging system within the application – if most of their work is going to be built and discussed here, it makes sense to allow them to make announcements and discuss updates on a blog-like service. I believe GitHub allows that too.
Some of these changes will affect the other models as well, but I’ve decided not to include them here as there isn’t going to be much of a change in logic right now 🙂
In other news, I have developed a real bad wrist problem – it hurts at times making it really difficult to type 😦 . I just hope to get over it soon.