Commit fcc76897b6e613c8d8e5c0a9a23e75fc8e3b61b3
1 parent
ae2c3231
Exists in
master
and in
29 other branches
ActionItem114: fixed some integration errors and the integration tests
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@873 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
9 changed files
with
15 additions
and
16 deletions
Show diff stats
app/controllers/environment_admin/admin_panel_controller.rb
app/controllers/profile_admin/cms_controller.rb
1 | 1 | class CmsController < Comatose::AdminController |
2 | 2 | include PermissionCheck |
3 | - | |
3 | + include AuthenticatedSystem | |
4 | 4 | |
5 | 5 | |
6 | 6 | define_option :page_class, Article |
... | ... | @@ -12,4 +12,8 @@ class CmsController < Comatose::AdminController |
12 | 12 | def profile |
13 | 13 | Profile.find_by_identifier(params[:profile]) |
14 | 14 | end |
15 | + | |
16 | + def user | |
17 | + current_user.person | |
18 | + end | |
15 | 19 | end | ... | ... |
app/controllers/public/account_controller.rb
... | ... | @@ -41,7 +41,7 @@ class AccountController < PublicController |
41 | 41 | self.current_user = @user |
42 | 42 | owner_role = Role.find_by_name('owner') |
43 | 43 | @user.person.affiliate(@user.person, [owner_role]) if owner_role |
44 | - redirect_back_or_default(homepage_path(:profile => current_user.login)) | |
44 | + redirect_back_or_default(myprofile_path(:controller => 'profile_editor', :profile => current_user.login)) | |
45 | 45 | flash[:notice] = _("Thanks for signing up!") |
46 | 46 | end |
47 | 47 | rescue ActiveRecord::RecordInvalid | ... | ... |
app/views/profile_editor/index.rhtml
test/integration/enable_disable_features_test.rb
1 | 1 | require "#{File.dirname(__FILE__)}/../test_helper" |
2 | 2 | |
3 | 3 | class EnableDisableFeaturesTest < ActionController::IntegrationTest |
4 | - fixtures :domains, :environments, :users, :profiles | |
4 | + all_fixtures | |
5 | 5 | |
6 | 6 | def test_enable_features |
7 | 7 | uses_host 'anhetegua.net' |
8 | - login 'johndoe', 'test' | |
8 | + login 'ze', 'test' | |
9 | 9 | |
10 | 10 | get '/admin/features' |
11 | 11 | assert_response :success | ... | ... |
test/integration/manage_documents_test.rb
... | ... | @@ -2,17 +2,13 @@ require "#{File.dirname(__FILE__)}/../test_helper" |
2 | 2 | |
3 | 3 | class ManageDocumentsTest < ActionController::IntegrationTest |
4 | 4 | |
5 | - fixtures :users, :profiles, :comatose_pages, :domains, :environments | |
5 | + all_fixtures | |
6 | 6 | |
7 | 7 | def test_creation_of_a_new_article |
8 | 8 | count = Article.count |
9 | 9 | |
10 | 10 | login('ze', 'test') |
11 | 11 | |
12 | - assert_tag :tag => 'a', :attributes => { :href => '/account' } | |
13 | - get '/account' | |
14 | - assert_response :success | |
15 | - | |
16 | 12 | assert_tag :tag => 'a', :attributes => { :href => '/myprofile/ze/cms' } |
17 | 13 | |
18 | 14 | get '/myprofile/ze/cms' | ... | ... |
test/integration/signup_test.rb
1 | 1 | require "#{File.dirname(__FILE__)}/../test_helper" |
2 | 2 | |
3 | 3 | class AccountTest < ActionController::IntegrationTest |
4 | - fixtures :users, :profiles, :domains, :environments | |
4 | + all_fixtures | |
5 | 5 | |
6 | 6 | def test_should_require_acceptance_of_terms_for_signup |
7 | - Environment.default.update_attributes(:terms_of_use => 'You agree that from now on your soul belongs to us.') | |
7 | + Environment.default.update_attributes(:terms_of_use => 'You agree to not be annoying.') | |
8 | 8 | |
9 | 9 | count = User.count |
10 | 10 | ... | ... |
test/integration/user_registers_at_the_application_test.rb
... | ... | @@ -3,7 +3,6 @@ require "#{File.dirname(__FILE__)}/../test_helper" |
3 | 3 | class UserRegistersAtTheApplicationTest < ActionController::IntegrationTest |
4 | 4 | fixtures :users, :environments, :profiles |
5 | 5 | |
6 | - # Replace this with your real tests. | |
7 | 6 | def test_successfull_registration |
8 | 7 | get '/' |
9 | 8 | assert_tag :tag => 'span', :attributes => { :id => 'register_box' } |
... | ... | @@ -13,7 +12,7 @@ class UserRegistersAtTheApplicationTest < ActionController::IntegrationTest |
13 | 12 | |
14 | 13 | post '/account/signup', :user => { :login => 'mylogin', :password => 'mypassword', :password_confirmation => 'mypassword', :email => 'mylogin@example.com' } |
15 | 14 | assert_response :redirect |
16 | - assert_redirected_to '/account' | |
15 | + assert_redirected_to myprofile_path(:controller => 'profile_editor', :profile => 'mylogin') | |
17 | 16 | |
18 | 17 | # user is logged in right after the registration |
19 | 18 | follow_redirect! | ... | ... |
test/test_helper.rb
... | ... | @@ -91,6 +91,6 @@ class ActionController::IntegrationTest |
91 | 91 | post '/account/login', :login => username, :password => password |
92 | 92 | assert_response :redirect |
93 | 93 | follow_redirect! |
94 | - assert_equal myprofile_path(:controller => 'profile_editor', :profile => username), path | |
94 | + assert_not_equal '/account/login', path | |
95 | 95 | end |
96 | 96 | end | ... | ... |