Skip to content
Snippets Groups Projects
Unverified Commit 7a366369 authored by Sébastien Gaya's avatar Sébastien Gaya
Browse files

make sure APPLICATION_ENV is correct in test mode, ExtranetSetup dry

parent bded541b
No related branches found
No related tags found
No related merge requests found
Showing
with 26 additions and 36 deletions
......@@ -35,6 +35,10 @@ module University::WithIdentifier
ENV['OSUNY_STAGING'] || '.osuny.dev'
end
def self.test_domain
ENV['OSUNY_TEST'] || '.osuny.test'
end
def self.development_domain
ENV['OSUNY_DEV'] || '.osuny'
end
......
require "test_helper"
class Extranet::AcademicYearsControllerTest < ActionDispatch::IntegrationTest
def setup
host! "extranet.osuny"
sign_in_with_2fa(alumnus)
end
include ExtranetSetup
def test_index
get education_academic_years_path
......
require "test_helper"
class Extranet::AccountControllerTest < ActionDispatch::IntegrationTest
def setup
host! "extranet.osuny"
sign_in_with_2fa(alumnus)
end
include ExtranetSetup
def test_show
get account_path
......
require "test_helper"
class Extranet::CohortsControllerTest < ActionDispatch::IntegrationTest
def setup
host! "extranet.osuny"
sign_in_with_2fa(alumnus)
end
include ExtranetSetup
def test_index
get education_cohorts_path
......
require "test_helper"
class Extranet::ExperiencesControllerTest < ActionDispatch::IntegrationTest
def setup
host! "extranet.osuny"
sign_in_with_2fa(alumnus)
end
include ExtranetSetup
def test_new
get new_experience_path
......
require "test_helper"
class Extranet::HomeControllerTest < ActionDispatch::IntegrationTest
def test_index_unknown_context
get(root_path)
assert_response(:forbidden)
end
def test_index_unauthenticated
host! "extranet.osuny"
host! "extranet.osuny.test"
get(root_path)
assert_redirected_to(new_user_session_path)
end
def test_index
host! "extranet.osuny"
host! "extranet.osuny.test"
sign_in_with_2fa(alumnus)
get(root_path)
assert_response(:success)
......
require "test_helper"
class Extranet::OrganizationsControllerTest < ActionDispatch::IntegrationTest
def setup
host! "extranet.osuny"
sign_in_with_2fa(alumnus)
end
include ExtranetSetup
def test_index
get university_organizations_path
......
require "test_helper"
class Extranet::PagesControllerTest < ActionDispatch::IntegrationTest
def setup
host! "extranet.osuny"
sign_in_with_2fa(alumnus)
end
include ExtranetSetup
def test_terms
get terms_path
......
require "test_helper"
class Extranet::PersonalDataControllerTest < ActionDispatch::IntegrationTest
def setup
host! "extranet.osuny"
sign_in_with_2fa(alumnus)
end
include ExtranetSetup
def test_edit
get edit_personal_data_path
......
require "test_helper"
class Extranet::PersonsControllerTest < ActionDispatch::IntegrationTest
def setup
host! "extranet.osuny"
sign_in_with_2fa(alumnus)
end
include ExtranetSetup
def test_index
get university_persons_path
......
......@@ -35,6 +35,6 @@
default_extranet:
name: Extranet de test
host: extranet.osuny
host: extranet.osuny.test
about: default_program (Education::Program)
university: default_university
\ No newline at end of file
......@@ -28,3 +28,4 @@
#
default_university:
name: Université de test
identifier: my-university
module ExtranetSetup
def setup
host! "extranet.osuny.test"
sign_in_with_2fa(alumnus)
end
end
\ No newline at end of file
......@@ -13,6 +13,10 @@ class ActiveSupport::TestCase
fixtures :all
setup do
ENV.update(ENV.to_h.merge('APPLICATION_ENV' => 'test'))
end
def alumnus
@alumnus ||= users(:alumnus)
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment