Search code examples
ruby-on-railsrubytestunit

How do you "nest" or "group" Test::Unit tests?


RSpec has:

describe "the user" do
  before(:each) do
    @user = Factory :user
  end

  it "should have access" do
    @user.should ...
  end
end

How would you group tests like that with Test::Unit? For example, in my controller test, I want to test the controller when a user is signed in and when nobody is signed in.


Solution

  • Test::Unit, to my knowledge, does not support test contexts. However, the gem contest adds support for context blocks.