From f5d42e2feac856d92413d6fa1f1fdc903c87124a Mon Sep 17 00:00:00 2001 From: AntonioTerceiro Date: Mon, 10 Dec 2007 21:16:35 +0000 Subject: [PATCH] ActionItem135: adding two new assertions --- test/test_helper.rb | 10 +++++++++- test/unit/region_test.rb | 7 ++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/test/test_helper.rb b/test/test_helper.rb index 28bb38c..b8b3b3c 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -81,6 +81,14 @@ class Test::Unit::TestCase assert( ((enum1 - enum2) == []) && ((enum2 - enum1) == []), "<#{enum1.inspect}> expected to be equivalent to <#{enum2.inspect}>") end + def assert_includes(array, element) + assert(array.include?(element), "<#{array.inspect}> expected to include <#{element.inspect}>") + end + + def assert_not_includes(array, element) + assert(!array.include?(element), "<#{array.inspect}> expected to NOT include <#{element.inspect}>") + end + private def uses_host(name) @@ -91,7 +99,7 @@ end class ActionController::IntegrationTest def login(username, password) - post '/account/login', :login => username, :password => password + post '/account/login', :user => { :login => username, :password => password } assert_response :redirect follow_redirect! assert_not_equal '/account/login', path diff --git a/test/unit/region_test.rb b/test/unit/region_test.rb index 7daa002..a9f4213 100644 --- a/test/unit/region_test.rb +++ b/test/unit/region_test.rb @@ -24,7 +24,8 @@ class RegionTest < Test::Unit::TestCase possible = region.search_possible_validators('organization') assert possible.include?(org2) - assert possible.include?(org1) + assert_includes possible, org2 + assert_includes possible, org1 end should 'return search results without validators that are already associated to the current region' do @@ -35,8 +36,8 @@ class RegionTest < Test::Unit::TestCase region.validators << org1 possible = region.search_possible_validators('organization') - assert possible.include?(org2) - assert !possible.include?(org1) + assert_includes possible, org2 + assert_not_includes possible, org1 end end -- libgit2 0.21.2