Commit 1ae3e6da4e7fe96273910b2dd2b7649971e29f17
1 parent
a3d9f0bb
Exists in
master
and in
29 other branches
ActionItem3: adding an integration test for features administration
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@95 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
2 changed files
with
31 additions
and
0 deletions
Show diff stats
@@ -0,0 +1,20 @@ | @@ -0,0 +1,20 @@ | ||
1 | +require "#{File.dirname(__FILE__)}/../test_helper" | ||
2 | + | ||
3 | +class EnableDisableFeaturesTest < ActionController::IntegrationTest | ||
4 | + fixtures :virtual_communities, :users | ||
5 | + | ||
6 | + def test_enable_features | ||
7 | + uses_host 'anhetegua.net' | ||
8 | + login('quentin', 'test') | ||
9 | + get '/admin/features' | ||
10 | + assert_response :success | ||
11 | + assert_tag :tag => 'input', :attributes => { :name => 'features[feature1]' } | ||
12 | + assert_tag :tag => 'input', :attributes => { :name => 'features[feature2]' } | ||
13 | + assert_tag :tag => 'input', :attributes => { :name => 'features[feature3]' } | ||
14 | + post 'admin/features/update' | ||
15 | + assert_response :redirect | ||
16 | + follow_redirect! | ||
17 | + assert_response :success | ||
18 | + assert_equal '/admin/features', path | ||
19 | + end | ||
20 | +end |
test/test_helper.rb
@@ -26,6 +26,8 @@ class Test::Unit::TestCase | @@ -26,6 +26,8 @@ class Test::Unit::TestCase | ||
26 | 26 | ||
27 | # Add more helper methods to be used by all tests here... | 27 | # Add more helper methods to be used by all tests here... |
28 | 28 | ||
29 | + include AuthenticatedTestHelper | ||
30 | + | ||
29 | private | 31 | private |
30 | 32 | ||
31 | def uses_host(name) | 33 | def uses_host(name) |
@@ -33,3 +35,12 @@ class Test::Unit::TestCase | @@ -33,3 +35,12 @@ class Test::Unit::TestCase | ||
33 | end | 35 | end |
34 | 36 | ||
35 | end | 37 | end |
38 | + | ||
39 | +class ActionController::IntegrationTest | ||
40 | + def login(username, password) | ||
41 | + post '/account/login', :login => username, :password => password | ||
42 | + assert_response :redirect | ||
43 | + follow_redirect! | ||
44 | + assert_equal '/account', path | ||
45 | + end | ||
46 | +end |