Gishu Pillai
2008-Jan-25  04:05 UTC
An elegant way of reusing Rails Test::Unit additions for Fit / Fitnesse fixtures
Hi,
Rails testing support is awesome. I''ve been trying to use Fit -
Fitnesse for acceptance testing.
Soon I was missing my get and post helper methods - Since they are
part of Test::Unit and fit fixtures have to derive from fixture
specific base classes. I turned to composition.. created a dummy test
case derivation as a member of the fixture. Distilled out the
essential things.. and it works.
However i was curious as to the manner in which others accomplish the
same thing. If you can think of better ways to do this.. please post
require File.dirname(__FILE__) + ''/../test/test_helper''
require ''inflow_controller''
require ''fit/fixture''
class RailsHelper < Test::Unit::TestCase
  def setup
    @controller = InflowController.new
    @request = ActionController::TestRequest.new
    @response = ActionController::TestResponse.new
  end
  def test_dummy
  end
end
module AcceptanceTests
  class EnterInflowRecords < Fit::Fixture
    attr_accessor :description, :amount
    def initialize
      @helper = RailsHelper.new("test_dummy")
      @helper.setup
    end
    def addEntry
      @helper.get :new
      @helper.post :create, :credit => {:description =>
@description, :amount => @amount}
    end
    def current_balance
      return 0
    end
  end
end
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---