Commit f5d42e2feac856d92413d6fa1f1fdc903c87124a
1 parent
ab3487d7
Exists in
master
and in
28 other branches
ActionItem135: adding two new assertions
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1087 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
2 changed files
with
13 additions
and
4 deletions
Show diff stats
test/test_helper.rb
| ... | ... | @@ -81,6 +81,14 @@ class Test::Unit::TestCase |
| 81 | 81 | assert( ((enum1 - enum2) == []) && ((enum2 - enum1) == []), "<#{enum1.inspect}> expected to be equivalent to <#{enum2.inspect}>") |
| 82 | 82 | end |
| 83 | 83 | |
| 84 | + def assert_includes(array, element) | |
| 85 | + assert(array.include?(element), "<#{array.inspect}> expected to include <#{element.inspect}>") | |
| 86 | + end | |
| 87 | + | |
| 88 | + def assert_not_includes(array, element) | |
| 89 | + assert(!array.include?(element), "<#{array.inspect}> expected to NOT include <#{element.inspect}>") | |
| 90 | + end | |
| 91 | + | |
| 84 | 92 | private |
| 85 | 93 | |
| 86 | 94 | def uses_host(name) |
| ... | ... | @@ -91,7 +99,7 @@ end |
| 91 | 99 | |
| 92 | 100 | class ActionController::IntegrationTest |
| 93 | 101 | def login(username, password) |
| 94 | - post '/account/login', :login => username, :password => password | |
| 102 | + post '/account/login', :user => { :login => username, :password => password } | |
| 95 | 103 | assert_response :redirect |
| 96 | 104 | follow_redirect! |
| 97 | 105 | assert_not_equal '/account/login', path | ... | ... |
test/unit/region_test.rb
| ... | ... | @@ -24,7 +24,8 @@ class RegionTest < Test::Unit::TestCase |
| 24 | 24 | |
| 25 | 25 | possible = region.search_possible_validators('organization') |
| 26 | 26 | assert possible.include?(org2) |
| 27 | - assert possible.include?(org1) | |
| 27 | + assert_includes possible, org2 | |
| 28 | + assert_includes possible, org1 | |
| 28 | 29 | end |
| 29 | 30 | |
| 30 | 31 | should 'return search results without validators that are already associated to the current region' do |
| ... | ... | @@ -35,8 +36,8 @@ class RegionTest < Test::Unit::TestCase |
| 35 | 36 | region.validators << org1 |
| 36 | 37 | |
| 37 | 38 | possible = region.search_possible_validators('organization') |
| 38 | - assert possible.include?(org2) | |
| 39 | - assert !possible.include?(org1) | |
| 39 | + assert_includes possible, org2 | |
| 40 | + assert_not_includes possible, org1 | |
| 40 | 41 | end |
| 41 | 42 | |
| 42 | 43 | end | ... | ... |