From b5ca63ab9c95720fe44ed7cddf0d4ef85ad8c9c3 Mon Sep 17 00:00:00 2001 From: Braulio Bhavamitra Date: Mon, 6 Apr 2015 22:47:49 -0300 Subject: [PATCH] rails4: fix profile tests --- lib/noosfero/core_ext/active_record.rb | 6 +++--- test/factories.rb | 2 +- test/unit/enterprise_test.rb | 2 +- test/unit/environment_test.rb | 2 +- test/unit/profile_test.rb | 9 +++++---- test/unit/uploaded_file_test.rb | 2 +- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/lib/noosfero/core_ext/active_record.rb b/lib/noosfero/core_ext/active_record.rb index 8d94d49..63fff73 100644 --- a/lib/noosfero/core_ext/active_record.rb +++ b/lib/noosfero/core_ext/active_record.rb @@ -9,10 +9,10 @@ class ActiveRecord::Base # an ActionView instance for rendering views on models def self.action_view @action_view ||= begin - view_paths = ActionController::Base.view_paths - action_view = ActionView::Base.new view_paths + view_paths = ::ActionController::Base.view_paths + action_view = ::ActionView::Base.new view_paths # for using Noosfero helpers inside render calls - action_view.extend ApplicationHelper + action_view.extend ::ApplicationHelper action_view end end diff --git a/test/factories.rb b/test/factories.rb index 5e9fe99..1a1e4c1 100644 --- a/test/factories.rb +++ b/test/factories.rb @@ -89,7 +89,7 @@ module Noosfero::Factory :password_confirmation => name.underscore }.merge(options) user = build(User, data) - user.person = build(Person, person_options) + user.person_data = person_options user.save! user end diff --git a/test/unit/enterprise_test.rb b/test/unit/enterprise_test.rb index 04a549a..d6a89bd 100644 --- a/test/unit/enterprise_test.rb +++ b/test/unit/enterprise_test.rb @@ -38,7 +38,7 @@ class EnterpriseTest < ActiveSupport::TestCase def test_has_domains p = Enterprise.new - assert_kind_of Array, p.domains + assert p.domains.empty? end def test_belongs_to_environment_and_has_default diff --git a/test/unit/environment_test.rb b/test/unit/environment_test.rb index 363030a..2bf75c6 100644 --- a/test/unit/environment_test.rb +++ b/test/unit/environment_test.rb @@ -173,7 +173,7 @@ class EnvironmentTest < ActiveSupport::TestCase should 'have regions' do env = fast_create(Environment) - assert_kind_of Array, env.regions + assert env.regions.empty? assert_raise ActiveRecord::AssociationTypeMismatch do env.regions << 1 end diff --git a/test/unit/profile_test.rb b/test/unit/profile_test.rb index 87865d5..7a02210 100644 --- a/test/unit/profile_test.rb +++ b/test/unit/profile_test.rb @@ -36,7 +36,7 @@ class ProfileTest < ActiveSupport::TestCase def test_has_domains p = Profile.new - assert_kind_of Array, p.domains + assert p.domains.empty? end should 'be assigned to default environment if no environment is informed' do @@ -771,7 +771,7 @@ class ProfileTest < ActiveSupport::TestCase should 'nickname be able to be nil' do p = Profile.new() p.valid? - assert_blank p.errors[:nickname] + assert p.errors[:nickname].blank? end should 'filter html from nickname' do @@ -1382,13 +1382,13 @@ class ProfileTest < ActiveSupport::TestCase should 'profile be valid when image is empty' do profile = build(Profile, :image_builder => {:uploaded_data => ""}) profile.valid? - assert_blank profile.errors[:image] + assert profile.errors[:image].blank? end should 'profile be valid when has no image' do profile = Profile.new profile.valid? - assert_blank profile.errors[:image] + assert profile.errors[:image].blank? end should 'copy header and footer after create a person' do @@ -1398,6 +1398,7 @@ class ProfileTest < ActiveSupport::TestCase Environment.any_instance.stubs(:person_default_template).returns(template) person = create_user_full('mytestuser').person + assert_equal person.environment.person_default_template, person.template assert_equal "footer customized", person.custom_footer assert_equal "header customized", person.custom_header end diff --git a/test/unit/uploaded_file_test.rb b/test/unit/uploaded_file_test.rb index 1f40e87..8a5acfe 100644 --- a/test/unit/uploaded_file_test.rb +++ b/test/unit/uploaded_file_test.rb @@ -147,7 +147,7 @@ class UploadedFileTest < ActiveSupport::TestCase should 'use name as title by default but cut down the title' do upload = build(UploadedFile, :uploaded_data => fixture_file_upload('/files/AGENDA_CULTURA_-_FESTA_DE_VAQUEIROS_PONTO_DE_SERRA_PRETA_BAIXA.txt')) upload.valid? - assert_blank upload.errors[:title] + assert upload.errors[:title].blank? end should 'create thumbnails after processing jobs' do -- libgit2 0.21.2