Mercurial > hg > soundsoftware-site
comparison test/integration/application_test.rb @ 1526:404aa68d4227
Merge from live branch
author | Chris Cannam |
---|---|
date | Thu, 11 Sep 2014 12:46:20 +0100 |
parents | e248c7af89ec |
children |
comparison
equal
deleted
inserted
replaced
1493:a5f2bdf3b486 | 1526:404aa68d4227 |
---|---|
1 # Redmine - project management software | 1 # Redmine - project management software |
2 # Copyright (C) 2006-2012 Jean-Philippe Lang | 2 # Copyright (C) 2006-2014 Jean-Philippe Lang |
3 # | 3 # |
4 # This program is free software; you can redistribute it and/or | 4 # This program is free software; you can redistribute it and/or |
5 # modify it under the terms of the GNU General Public License | 5 # modify it under the terms of the GNU General Public License |
6 # as published by the Free Software Foundation; either version 2 | 6 # as published by the Free Software Foundation; either version 2 |
7 # of the License, or (at your option) any later version. | 7 # of the License, or (at your option) any later version. |
24 :enumerations, :users, :issue_categories, | 24 :enumerations, :users, :issue_categories, |
25 :projects_trackers, | 25 :projects_trackers, |
26 :roles, | 26 :roles, |
27 :member_roles, | 27 :member_roles, |
28 :members, | 28 :members, |
29 :enabled_modules, | 29 :enabled_modules |
30 :workflows | |
31 | 30 |
32 def test_set_localization | 31 def test_set_localization |
33 Setting.default_language = 'en' | 32 Setting.default_language = 'en' |
34 | 33 |
35 # a french user | 34 # a french user |
36 get 'projects', { }, 'HTTP_ACCEPT_LANGUAGE' => 'fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3' | 35 get 'projects', { }, 'HTTP_ACCEPT_LANGUAGE' => 'fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3' |
37 assert_response :success | 36 assert_response :success |
38 assert_tag :tag => 'h2', :content => 'Projets' | 37 assert_tag :tag => 'h2', :content => 'Projets' |
39 assert_equal :fr, current_language | 38 assert_equal :fr, current_language |
39 assert_select "html[lang=?]", "fr" | |
40 | 40 |
41 # then an italien user | 41 # then an italien user |
42 get 'projects', { }, 'HTTP_ACCEPT_LANGUAGE' => 'it;q=0.8,en-us;q=0.5,en;q=0.3' | 42 get 'projects', { }, 'HTTP_ACCEPT_LANGUAGE' => 'it;q=0.8,en-us;q=0.5,en;q=0.3' |
43 assert_response :success | 43 assert_response :success |
44 assert_tag :tag => 'h2', :content => 'Progetti' | 44 assert_tag :tag => 'h2', :content => 'Progetti' |
45 assert_equal :it, current_language | 45 assert_equal :it, current_language |
46 assert_select "html[lang=?]", "it" | |
46 | 47 |
47 # not a supported language: default language should be used | 48 # not a supported language: default language should be used |
48 get 'projects', { }, 'HTTP_ACCEPT_LANGUAGE' => 'zz' | 49 get 'projects', { }, 'HTTP_ACCEPT_LANGUAGE' => 'zz' |
49 assert_response :success | 50 assert_response :success |
50 assert_tag :tag => 'h2', :content => 'Projects' | 51 assert_tag :tag => 'h2', :content => 'Projects' |
52 assert_select "html[lang=?]", "en" | |
51 end | 53 end |
52 | 54 |
53 def test_token_based_access_should_not_start_session | 55 def test_token_based_access_should_not_start_session |
54 # issue of a private project | 56 # issue of a private project |
55 get 'issues/4.atom' | 57 get 'issues/4.atom' |
63 | 65 |
64 def test_missing_template_should_respond_with_404 | 66 def test_missing_template_should_respond_with_404 |
65 get '/login.png' | 67 get '/login.png' |
66 assert_response 404 | 68 assert_response 404 |
67 end | 69 end |
70 | |
71 def test_invalid_token_should_call_custom_handler | |
72 ActionController::Base.allow_forgery_protection = true | |
73 post '/issues' | |
74 assert_response 422 | |
75 assert_include "Invalid form authenticity token.", response.body | |
76 ensure | |
77 ActionController::Base.allow_forgery_protection = false | |
78 end | |
68 end | 79 end |