views:

248

answers:

1

I'd like to try out Jeremy Mcanally's context gem for testing:

http://github.com/jeremymcanally/context/tree/master

It does not work out of the box with Rails 2.3.x, anyone got it working?

EDIT hi mike, tx for ur help. i installed the gem like u said, and have added "require 'context'" to test_helper.rb however, it stil doesn't seem to b behaving correctly. the followin unit test is failing as @truth is nil.

context "a simple truth" do
  before do
    @truth = true
  end

  test "the truth1" do
    assert @truth
  end
end

any idea?

EDIT screw it... i installed shoulda http://github.com/thoughtbot/shoulda/tree/master even just for the context blocks (for now anyway) and it's working great.

A: 

This is what I found...

Did you download the source from github.com or gem install context? If the latter, then start off with a gem uninstall, because whatever the rubygems context is, it ain't Mr Macanally's one!

Once you have the source, unzip (or untar) it somewhere and in that directory, run gem build context.gemspec, which for me produced a file named context-0.5.5.gem. Now you can do 'gem install context-0.5.5.gem' and you have the right library installed.

Last thing to do is to tell your tests about the new gem. I added require 'context' to RAILS_ROOT/test/test_helper.rb and bingo!

That's what worked for me, at least.

Mike Woodhouse