Simply Bdd plugin

Plugin details

Allows you to use context and specify macros for creating TestCase classes

Repositoryhttp://svn.techno-weenie.net/projects/plugins/simply_bdd Author Rick Olson Tags Tests LicenseUnknown

Documentation

Install the plugin:
ruby script/plugin install http://svn.techno-weenie.net/projects/plugins/simply_bdd
  context "New User" do
    def setup
      @user = User.new
    end
  
    specify "should be invalid without a username" do
      assert !@user.valid?
      @user.username = 'someusername'
      assert_valid @user
    end
  end



This (dynamically) generates a class like:

  class NewUserTest < Test::Unit::TestCase
    def setup
      @user = User.new
    end
    
    def test_should_be_invalid_without_a_username
      assert !@user.valid?
      @user.username = 'someusername'
      assert_valid @user
    end
  end



You can specify a superclass for context so the class inherits from it instead:

  context "Post Controller Creation", PostControllerTest do
    ...
  end



You can also nest context calls to get automatic inheritance:

  context "Post Controller" do
    context "Post Controller Creation" do
      ...
    end
  end

Further Documentation

There is currently no advanced documentation for this plugin.

New documentation

Edit plugin | (0 older versions) | Last edited by: scott, 8 months ago