Commit da64145cb5e91c2babf5bd2b5884ddca7bff49a6
1 parent
81340e01
Exists in
master
and in
29 other branches
ActionItem12: writing integration test
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@486 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
1 changed file
with
29 additions
and
0 deletions
Show diff stats
... | ... | @@ -0,0 +1,29 @@ |
1 | +require "#{File.dirname(__FILE__)}/../test_helper" | |
2 | + | |
3 | +class AccountTest < ActionController::IntegrationTest | |
4 | + fixtures :users, :profiles, :domains, :virtual_communities | |
5 | + | |
6 | + def test_should_require_acceptance_of_terms_for_signup | |
7 | + VirtualCommunity.default.update_attributes(:terms_of_use => 'You agree that from now on your soul belongs to us.') | |
8 | + | |
9 | + count = User.count | |
10 | + | |
11 | + get '/account/signup' | |
12 | + assert_response :success | |
13 | + assert_tag :tag => 'input', :attributes => { :name => 'user[terms_accepted]' } | |
14 | + | |
15 | + post '/account/signup', :user => { :login => 'shouldaccepterms', :password => 'test', :password_confirmation => 'test', :email => 'shouldaccepterms@example.com' } | |
16 | + assert_response :success | |
17 | + assert_template 'signup' | |
18 | + assert_equal count, User.count | |
19 | + | |
20 | + post '/account/signup', :user => { :login => 'shouldaccepterms', :password => 'test', :password_confirmation => 'test', :email => 'shouldaccepterms@example.com', :terms_accepted => '1' } | |
21 | + assert_response :redirect | |
22 | + | |
23 | + follow_redirect! | |
24 | + assert_response :success | |
25 | + assert_equal count + 1, User.count | |
26 | + | |
27 | + end | |
28 | + | |
29 | +end | ... | ... |