From 869128a0faf244dd7366fe0437441dad2f6d8aea Mon Sep 17 00:00:00 2001 From: AntonioTerceiro Date: Fri, 22 Feb 2008 23:05:16 +0000 Subject: [PATCH] ActionItem172: adding extra parameters implictly in get and post methods for functional tests --- lib/noosfero_test.rb | 11 +++++++++++ test/test_helper.rb | 1 + 2 files changed, 12 insertions(+), 0 deletions(-) diff --git a/lib/noosfero_test.rb b/lib/noosfero_test.rb index d7958c2..6f5853c 100644 --- a/lib/noosfero_test.rb +++ b/lib/noosfero_test.rb @@ -8,5 +8,16 @@ module NoosferoTest super(path, (parameters ? self.class.extra_parameters.merge(parameters) : self.class.extra_parameters), headers) end + module ClassMethods + def noosfero_test(parameters) + instance_variable_set('@noosfero_test_extra_parameters', parameters) + def extra_parameters + @noosfero_test_extra_parameters + end + include NoosferoTest + end + end end + +Test::Unit::TestCase.send(:extend, NoosferoTest::ClassMethods) diff --git a/test/test_helper.rb b/test/test_helper.rb index d1d1122..7d2ecd6 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -2,6 +2,7 @@ ENV["RAILS_ENV"] = "test" require File.expand_path(File.dirname(__FILE__) + "/../config/environment") require 'test_help' require 'mocha' +require 'noosfero_test' class Test::Unit::TestCase # Transactional fixtures accelerate your tests by wrapping each test method -- libgit2 0.21.2