OLM On Rails

Blog Location Has Moved

leave a comment »

Please note that we are no longer active at this site. Have a look at our new blog: http://blog.markusproject.org


Written by jerboaa

June 19, 2009 at 8:51 pm

Posted in Uncategorized

Markus Tests

leave a comment »

These last few days, I have been looking at our tests.

Due to all the changes we made the last months, most of the tests didn’t work at all. They refered to none existing properties, methods or fixtures. I tried to fix them all, and now, the major part of our unit tests work, and pass.

I ran into a small problem: I first ran all the tests one by one, with the command:

ruby -I test test/unit/name_of_the_file.rb

34 files only for the unit test, so 34 times this line. The command

rake test:units

launches all the test at once. For now, it launches 99 tests, has 138 assertions, and 2 errors, then it aborts…

Still some work to do!

Written by nvaroqua

June 15, 2009 at 11:54 am

Posted in Uncategorized

Our first screen cast

leave a comment »

Last week, Mike recorded our first screencast of OLM, now renamed Markus.

We got a bit of trouble, finding a way to post it here, as it is a swf format: we couldn’t upload it directly on the blog.

Finally, we found a solution. Karen uploaded it on another server, and here is the link:



Written by nvaroqua

June 12, 2009 at 11:16 am

Posted in Uncategorized

How to Install Seed_fu

with one comment

Today, we got a pretty awesome cursory code review from Mike Gunderloy.

One thing he suggested, was that we switch from running a sloppy Ruby script to seed our database with initial data, to something like seed_fu.

So, how do we install Seed_fu?  It took me a while to figure it out, actually, since I’d never installed a Rails plugin from GitHub before.

Anyhow, here’s how you do it:

From your application root:

script/plugin install git://github.com/mbleigh/seed-fu.git


Written by Mike Conley

June 11, 2009 at 5:07 pm

Posted in OLM on Rails

Tagged with , ,

Single Table Inheritance, and Testing Fixtures

with 2 comments

I’m still trying to get our unit tests up and running, and I ran into a snag a few hours ago.

I tried to run a single unit test, on the Admin model (which is a subclass of type User). I kept getting this error message:

ActiveRecord::StatementInvalid: PGError: ERROR: relation "students" does not exist
: DELETE FROM "students"

Hrmph. We don’t have a “students” table, so of course that won’t work. We have Students (which, like Admins, subclass from User), but we certainly don’t have a “students” table.

So how come it’s trying to access that table?

It turns out that Rails test fixtures don’t deal with Single Table Inheritance. Instead, a Rails fixture should be a YAML file that populates a particular table with its contents.

And it turns out I had a fixture called “students.yml” in my test/fixtures folder. So, Rails tried to connect to the “students” table, insert some records, and clear them out afterwards.

The solution was to remove the students.yml, tas.yml, and admins.yml files, and simply have a users.yml file. The same goes for student_memberships.yml and ta_memberships.yml. Replace those with memberships.yml. Boom. Tests run.

Now it’s just a matter of getting some good content in the fixtures, and getting some solid tests written…

Written by Mike Conley

May 26, 2009 at 1:54 pm

A Sneaky Change in Rails 2.3.2 Temporarily Broke Our Tests

leave a comment »

Today, I’ve decided to revamp the test suites for OLM. I won’t lie – we’ve been a little lazy in terms of testing. We have lots of meetings where we say “our testing is going to be solid”, but then nothing really happens.

I’m sure we’re not alone in this regard.

Anyhow, I decided to dust off our tests and give them a run. Here’s what I got:

./test/unit/../test_helper.rb:22: undefined method `use_transactional_fixtures=' for Test::Unit::TestCase:Class (NoMethodError)

Hrmph. What’s going on? After a little Googling, and it turns out that in Rails 2.3.2, “Test::Unit::TestCase changed to ActiveSupport::TestCase”.

So, I had to go into ./test/test_helper.rb, and change the class to ActiveSupport::TestCase. No big deal really, but it was confusing at first.

It’s a real blow to your self-esteem when your testing framework doesn’t even run.

Anyhow, it’s fixed. Now to write some good tests…

FOLLOW UP: You also need to change Test::Unit::TestCase to ActiveSupport::TestCase in your tests.

Written by Mike Conley

May 26, 2009 at 11:02 am

Using Subversion for File Storage

leave a comment »

Over the past few days, the team has been talking about how we eventually want to use Subversion as the file storage backend for the work that students submit through OLM.

Here’s what we ended up deciding:  we’re going to build a generic Repository class, and have three different implementations:  File System, Memory, and Subversion.

Each Repository will return Revision objects, and each revision will have File’s and (eventually) Directories.

So, how would this thing work?  Say I want to get all files from the root directory of a particular repository for the latest revision.  Here’s how we’d more or less want to pull it off with our classes in Ruby:

repo = Repository::RepositoryFactory("svn").open('/some/subversion/repository')
revision = repo.get_latest_revision
# I want all files for the root directory /.
files = revision.all_files('/')

This would provide a collection of File objects representing the files in the latest revision of the repository. If we wanted to download/display that file, we could use the following:

repo = Repository::RepositoryFactory("svn").open('/some/subversion/repository')
revision = repo.get_latest_revision
# Say I wanted the file Test.java from the root directory...
wanted_file = revision.all_files('/')["Test.java"]
file_output = repo.download(wanted_file)
#...insert code here to send file_output to browser

As it stands, that’s more or less how we’re designing the Repository classes. Big thanks to the Basie team for their suggestions on the design!

Anyhow, I’ll try to keep you all posted on our progress for implementing the Repositories.

Written by Mike Conley

May 25, 2009 at 12:47 am


Get every new post delivered to your Inbox.