From da64145cb5e91c2babf5bd2b5884ddca7bff49a6 Mon Sep 17 00:00:00 2001 From: AntonioTerceiro Date: Sat, 15 Sep 2007 18:21:02 +0000 Subject: [PATCH] ActionItem12: writing integration test --- test/integration/signup_test.rb | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+), 0 deletions(-) create mode 100644 test/integration/signup_test.rb diff --git a/test/integration/signup_test.rb b/test/integration/signup_test.rb new file mode 100644 index 0000000..1950ac7 --- /dev/null +++ b/test/integration/signup_test.rb @@ -0,0 +1,29 @@ +require "#{File.dirname(__FILE__)}/../test_helper" + +class AccountTest < ActionController::IntegrationTest + fixtures :users, :profiles, :domains, :virtual_communities + + def test_should_require_acceptance_of_terms_for_signup + VirtualCommunity.default.update_attributes(:terms_of_use => 'You agree that from now on your soul belongs to us.') + + count = User.count + + get '/account/signup' + assert_response :success + assert_tag :tag => 'input', :attributes => { :name => 'user[terms_accepted]' } + + post '/account/signup', :user => { :login => 'shouldaccepterms', :password => 'test', :password_confirmation => 'test', :email => 'shouldaccepterms@example.com' } + assert_response :success + assert_template 'signup' + assert_equal count, User.count + + post '/account/signup', :user => { :login => 'shouldaccepterms', :password => 'test', :password_confirmation => 'test', :email => 'shouldaccepterms@example.com', :terms_accepted => '1' } + assert_response :redirect + + follow_redirect! + assert_response :success + assert_equal count + 1, User.count + + end + +end -- libgit2 0.21.2