Return to Snippet

Revision: 22551
at January 15, 2010 06:49 by nflamel


Updated Code
require File.dirname(__FILE__) + '/../test_helper'
require 'action_view/test_case'

class MyHelperTest < ActionView::TestCase

  include MyHelper

  context 'a helper in some context' do
      setup do
        Factory(:some_object)
      end

      should 'assert this test' do
        assert_some_helper_function_works
      end
    end
end

Revision: 22550
at January 15, 2010 06:48 by nflamel


Initial Code
require 'action_view/test_case'

class MyHelperTest < ActionView::TestCase

  include MyHelper

  context 'a helper in some context' do
      setup do
        Factory(:some_object)
      end

      should 'assert this test' do
        assert_some_helper_function_works
      end
    end
end

Initial URL

                                

Initial Description
This is the code I use when I want to test a helper.
It uses Factory Girl and Shoulda, but they're not needed to make it work.

Initial Title
Test a helper class on Ruby On Rails

Initial Tags
rails

Initial Language
Rails