diff --git a/src/noosfero-spb/software_communities/test/functional/profile_controller_test.rb b/src/noosfero-spb/software_communities/test/functional/profile_controller_test.rb index 3805787..2bc18a4 100644 --- a/src/noosfero-spb/software_communities/test/functional/profile_controller_test.rb +++ b/src/noosfero-spb/software_communities/test/functional/profile_controller_test.rb @@ -1,10 +1,13 @@ -require "test_helper" +require 'test_helper' require 'profile_controller' +require File.dirname(__FILE__) + '/../helpers/plugin_test_helper' # Re-raise errors caught by the controller. class ProfileController; def rescue_action(e) raise e end; end class ProfileControllerTest < ActionController::TestCase + include PluginTestHelper + def setup Environment.default.enable('products_for_enterprises') @profile = create_user('testuser').person @@ -14,27 +17,28 @@ class ProfileControllerTest < ActionController::TestCase should 'not count a visit twice for the same user' do profile = create_user('someone').person login_as(@profile.identifier) - community = fast_create('Community') + software = create_software_info("a software").software - get :index, :profile => community.identifier - community.reload - assert_equal 1, community.hits + get :index, :profile => software.identifier + software.reload + assert_equal 1, software.hits - get :index, :profile => community.identifier - community.reload - assert_equal 1, community.hits + get :index, :profile => software.identifier + software.reload + assert_equal 1, software.hits end should 'not count a visit twice for unlogged users' do profile = create_user('someone').person - community = fast_create('Community') - get :index, :profile => community.identifier - community.reload - assert_equal 1, community.hits - - get :index, :profile => community.identifier - community.reload - assert_equal 1, community.hits + software = create_software_info("a software").software + + get :index, :profile => software.identifier + software.reload + assert_equal 1, software.hits + + get :index, :profile => software.identifier + software.reload + assert_equal 1, software.hits end end diff --git a/src/noosfero-spb/software_communities/test/functional/profile_editor_controller_test.rb b/src/noosfero-spb/software_communities/test/functional/profile_editor_controller_test.rb index b677a1d..525e1c6 100644 --- a/src/noosfero-spb/software_communities/test/functional/profile_editor_controller_test.rb +++ b/src/noosfero-spb/software_communities/test/functional/profile_editor_controller_test.rb @@ -29,15 +29,6 @@ class ProfileEditorControllerTest < ActionController::TestCase @environment.save end - should "redirect to edit_software_community on edit community of software" do - software = create_software_info("Test Software") - - post :edit, :profile => software.community.identifier - - assert_redirected_to :controller => 'profile_editor', :action => 'edit_software_community' - end - - protected def create_basic_user @@ -49,21 +40,24 @@ class ProfileEditorControllerTest < ActionController::TestCase user end - def create_community name - community = fast_create(Community) - community.name = name - community.save - community + def create_software name + software = Software.new + software.name = name + software.identifier = name.to_slug + software end def create_software_info name, finality = "something", acronym = "" - community = create_community(name) + software = create_software(name) software_info = SoftwareInfo.new - software_info.community = community + software_info.software = software software_info.finality = finality software_info.acronym = acronym software_info.public_software = true - software_info.save + + software.software_info = software_info + software.save! + software_info end -- libgit2 0.21.2