2 # This file is part of SMR.
4 # SMR is free software: you can redistribute it and/or modify it under the
5 # terms of the GNU General Public License as published by the Free Software
6 # Foundation, either version 3 of the License, or (at your option) any later
9 # SMR is distributed in the hope that it will be useful, but WITHOUT ANY
10 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License along with
14 # SMR. If not, see <http://www.gnu.org/licenses/>.
16 ENV["RAILS_ENV"] = "test"
17 include ActionDispatch::TestProcess
18 require File.expand_path('../../config/environment', __FILE__)
19 require 'rails/test_help'
21 class ActiveSupport::TestCase
22 # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
24 # Note: You'll currently still have to declare fixtures explicitly in integration tests
25 # -- they do not yet inherit this setting
28 # Add more helper methods to be used by all tests here...
33 # Success should redirect us to '/' showing Assets overview as its the
36 # See ActionDispatch::IntegrationTest documentation in case multiple
37 # parallel sessions are required at some point.
38 def smr_login(loginname, password)
39 post sessions_path, :login=>loginname, :password=>password
40 assert_response :redirect
42 assert_response :success
44 assert_equal root_path, path
45 assert_not_nil assigns(:current_user), 'login failed, no current_user'
46 assert_not_nil assigns(:assets), 'no Assets listed after login'
47 assert_not_nil assigns(:open_positions), 'no Open Positions listed after login'
49 # see we are logged in as the one we think we are and got a token
50 current_user = assigns(:current_user)
51 assert_equal current_user.login, loginname
52 assert current_user.password_auth_token