Commit 39e6787a657899ade2684eae526b4acc0b131e09

Authored by Tallys Martins
1 parent 0d0d8a31

Organization Ratings Plugin redirection fix

- Redirection after rating a profile now sends to
profile homepage instead of profile controller index.
plugins/organization_ratings/controllers/organization_ratings_plugin_profile_controller.rb
@@ -49,7 +49,7 @@ class OrganizationRatingsPluginProfileController < ProfileController @@ -49,7 +49,7 @@ class OrganizationRatingsPluginProfileController < ProfileController
49 session[:notice] = _("Sorry, there were problems rating this profile.") 49 session[:notice] = _("Sorry, there were problems rating this profile.")
50 end 50 end
51 51
52 - redirect_to :controller => 'profile', :action => 'index' 52 + redirect_to profile.url
53 end 53 end
54 54
55 def create_rating_comment(rating) 55 def create_rating_comment(rating)
plugins/organization_ratings/test/functional/organization_ratings_plugin_profile_controller_test.rb
@@ -29,6 +29,15 @@ class OrganizationRatingsPluginProfileControllerTest < ActionController::TestCas @@ -29,6 +29,15 @@ class OrganizationRatingsPluginProfileControllerTest < ActionController::TestCas
29 assert_equal "#{@community.name} successfully rated!", session[:notice] 29 assert_equal "#{@community.name} successfully rated!", session[:notice]
30 end 30 end
31 31
  32 + test "should redirect to profile home page" do
  33 + @blog = @community.blog
  34 + @community.home_page = @blog
  35 + @community.save
  36 + post :new_rating, profile: @community.identifier, :comments => {:body => "This is minor a test"}, :organization_rating_value => 3
  37 + assert_equal "#{@community.name} successfully rated!", session[:notice]
  38 + assert_redirected_to @community.url
  39 + end
  40 +
32 test "Create community_rating without comment body" do 41 test "Create community_rating without comment body" do
33 post :new_rating, profile: @community.identifier, :comments => {:body => ""}, :organization_rating_value => 2 42 post :new_rating, profile: @community.identifier, :comments => {:body => ""}, :organization_rating_value => 2
34 43