Commit 56f774e60b9107be7690a43b775aa539fd0948f2
1 parent
a4bd4d81
Exists in
master
and in
22 other branches
stoa-plugin-tests: replaces invalid?
ActiveResource::Errors#invalid? is deprecated on Rails 3 and was replaced by ActiveModel::Errors#include?
Showing
3 changed files
with
10 additions
and
10 deletions
Show diff stats
plugins/stoa/test/functional/account_controller_test.rb
| @@ -38,10 +38,10 @@ class AccountControllerTest < ActionController::TestCase | @@ -38,10 +38,10 @@ class AccountControllerTest < ActionController::TestCase | ||
| 38 | should 'pass if confirmation value matches' do | 38 | should 'pass if confirmation value matches' do |
| 39 | #StoaPlugin::UspUser.stubs(:matches?).returns(true) | 39 | #StoaPlugin::UspUser.stubs(:matches?).returns(true) |
| 40 | post :signup, :profile_data => {:usp_id => '12345678'}, :confirmation_field => 'cpf', :cpf => '12345678' | 40 | post :signup, :profile_data => {:usp_id => '12345678'}, :confirmation_field => 'cpf', :cpf => '12345678' |
| 41 | - assert_nil assigns(:person).errors[:usp_id] | 41 | + assert !assigns(:person).errors.include?(:usp_id) |
| 42 | end | 42 | end |
| 43 | 43 | ||
| 44 | - should 'inlude invitation_code param in the persons attributes' do | 44 | + should 'include invitation_code param in the persons attributes' do |
| 45 | get :signup, :invitation_code => 12345678 | 45 | get :signup, :invitation_code => 12345678 |
| 46 | assert assigns(:person).invitation_code == '12345678' | 46 | assert assigns(:person).invitation_code == '12345678' |
| 47 | end | 47 | end |
plugins/stoa/test/functional/profile_editor_controller_test.rb
| @@ -45,7 +45,7 @@ class StoaPluginProfileEditorControllerTest < ActionController::TestCase | @@ -45,7 +45,7 @@ class StoaPluginProfileEditorControllerTest < ActionController::TestCase | ||
| 45 | should 'display error if usp_id does not match with supplied confirmation' do | 45 | should 'display error if usp_id does not match with supplied confirmation' do |
| 46 | StoaPlugin::UspUser.stubs(:matches?).returns(false) | 46 | StoaPlugin::UspUser.stubs(:matches?).returns(false) |
| 47 | post :edit, :profile => person.identifier, :profile_data => {:usp_id => 12345678}, :confirmation_field => 'cpf', :cpf => 99999999 | 47 | post :edit, :profile => person.identifier, :profile_data => {:usp_id => 12345678}, :confirmation_field => 'cpf', :cpf => 99999999 |
| 48 | - assert assigns(:profile_data).errors.invalid?(:usp_id) | 48 | + assert assigns(:profile_data).errors.include?(:usp_id) |
| 49 | end | 49 | end |
| 50 | 50 | ||
| 51 | should 'save usp_id if everyhtings is ok' do | 51 | should 'save usp_id if everyhtings is ok' do |
plugins/stoa/test/unit/person_test.rb
| @@ -15,7 +15,7 @@ class StoaPlugin::Person < ActiveSupport::TestCase | @@ -15,7 +15,7 @@ class StoaPlugin::Person < ActiveSupport::TestCase | ||
| 15 | another_person = Person.new(:usp_id => usp_id) | 15 | another_person = Person.new(:usp_id => usp_id) |
| 16 | another_person.valid? | 16 | another_person.valid? |
| 17 | 17 | ||
| 18 | - assert another_person.errors.invalid?(:usp_id) | 18 | + assert another_person.errors.include?(:usp_id) |
| 19 | end | 19 | end |
| 20 | 20 | ||
| 21 | should 'not allow usp_id as an empty string' do | 21 | should 'not allow usp_id as an empty string' do |
| @@ -28,17 +28,17 @@ class StoaPlugin::Person < ActiveSupport::TestCase | @@ -28,17 +28,17 @@ class StoaPlugin::Person < ActiveSupport::TestCase | ||
| 28 | should 'allow nil usp_id only if person has an invitation_code or is a template' do | 28 | should 'allow nil usp_id only if person has an invitation_code or is a template' do |
| 29 | person = Person.new(:environment => environment) | 29 | person = Person.new(:environment => environment) |
| 30 | person.valid? | 30 | person.valid? |
| 31 | - assert person.errors.invalid?(:usp_id) | 31 | + assert person.errors.include?(:usp_id) |
| 32 | 32 | ||
| 33 | Task.create!(:code => 12345678) | 33 | Task.create!(:code => 12345678) |
| 34 | person.invitation_code = 12345678 | 34 | person.invitation_code = 12345678 |
| 35 | person.valid? | 35 | person.valid? |
| 36 | - assert !person.errors.invalid?(:usp_id) | 36 | + assert !person.errors.include?(:usp_id) |
| 37 | 37 | ||
| 38 | person.invitation_code = nil | 38 | person.invitation_code = nil |
| 39 | person.is_template = true | 39 | person.is_template = true |
| 40 | person.valid? | 40 | person.valid? |
| 41 | - assert !person.errors.invalid?(:usp_id) | 41 | + assert !person.errors.include?(:usp_id) |
| 42 | end | 42 | end |
| 43 | 43 | ||
| 44 | should 'allow multiple nil usp_id' do | 44 | should 'allow multiple nil usp_id' do |
| @@ -47,7 +47,7 @@ class StoaPlugin::Person < ActiveSupport::TestCase | @@ -47,7 +47,7 @@ class StoaPlugin::Person < ActiveSupport::TestCase | ||
| 47 | person = Person.new(:invitation_code => 87654321) | 47 | person = Person.new(:invitation_code => 87654321) |
| 48 | person.valid? | 48 | person.valid? |
| 49 | 49 | ||
| 50 | - assert !person.errors.invalid?(:usp_id) | 50 | + assert !person.errors.include?(:usp_id) |
| 51 | end | 51 | end |
| 52 | 52 | ||
| 53 | should 'not allow person to be saved with a finished invitation that is not his own' do | 53 | should 'not allow person to be saved with a finished invitation that is not his own' do |
| @@ -56,7 +56,7 @@ class StoaPlugin::Person < ActiveSupport::TestCase | @@ -56,7 +56,7 @@ class StoaPlugin::Person < ActiveSupport::TestCase | ||
| 56 | person = Person.new(:environment => environment, :invitation_code => 87654321) | 56 | person = Person.new(:environment => environment, :invitation_code => 87654321) |
| 57 | person.valid? | 57 | person.valid? |
| 58 | 58 | ||
| 59 | - assert person.errors.invalid?(:usp_id) | 59 | + assert person.errors.include?(:usp_id) |
| 60 | end | 60 | end |
| 61 | 61 | ||
| 62 | should 'allow person to be saved with a finished invitation if it is his own' do | 62 | should 'allow person to be saved with a finished invitation if it is his own' do |
| @@ -68,7 +68,7 @@ class StoaPlugin::Person < ActiveSupport::TestCase | @@ -68,7 +68,7 @@ class StoaPlugin::Person < ActiveSupport::TestCase | ||
| 68 | t.finish | 68 | t.finish |
| 69 | 69 | ||
| 70 | person.valid? | 70 | person.valid? |
| 71 | - assert !person.errors.invalid?(:usp_id) | 71 | + assert !person.errors.include?(:usp_id) |
| 72 | end | 72 | end |
| 73 | 73 | ||
| 74 | 74 |