Commit 869128a0faf244dd7366fe0437441dad2f6d8aea

Authored by AntonioTerceiro
1 parent ffc26a00

ActionItem172: adding extra parameters implictly in get and post methods for functional tests


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1480 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing 2 changed files with 12 additions and 0 deletions   Show diff stats
lib/noosfero_test.rb
@@ -8,5 +8,16 @@ module NoosferoTest @@ -8,5 +8,16 @@ module NoosferoTest
8 super(path, (parameters ? self.class.extra_parameters.merge(parameters) : self.class.extra_parameters), headers) 8 super(path, (parameters ? self.class.extra_parameters.merge(parameters) : self.class.extra_parameters), headers)
9 end 9 end
10 10
  11 + module ClassMethods
  12 + def noosfero_test(parameters)
  13 + instance_variable_set('@noosfero_test_extra_parameters', parameters)
  14 + def extra_parameters
  15 + @noosfero_test_extra_parameters
  16 + end
  17 + include NoosferoTest
  18 + end
  19 + end
11 20
12 end 21 end
  22 +
  23 +Test::Unit::TestCase.send(:extend, NoosferoTest::ClassMethods)
test/test_helper.rb
@@ -2,6 +2,7 @@ ENV["RAILS_ENV"] = "test" @@ -2,6 +2,7 @@ ENV["RAILS_ENV"] = "test"
2 require File.expand_path(File.dirname(__FILE__) + "/../config/environment") 2 require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
3 require 'test_help' 3 require 'test_help'
4 require 'mocha' 4 require 'mocha'
  5 +require 'noosfero_test'
5 6
6 class Test::Unit::TestCase 7 class Test::Unit::TestCase
7 # Transactional fixtures accelerate your tests by wrapping each test method 8 # Transactional fixtures accelerate your tests by wrapping each test method