mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-06 01:08:50 +01:00
Isolate SITE_CONFIG in tests using minitest-stub-const
This commit is contained in:
parent
3de582f436
commit
58e2b82315
6 changed files with 130 additions and 96 deletions
|
|
@ -1,6 +1,8 @@
|
|||
require 'test_helper'
|
||||
require 'support/stub_site_config_helper'
|
||||
|
||||
class StoriesTest < ActionDispatch::IntegrationTest
|
||||
include StubSiteConfigHelper
|
||||
|
||||
# ####################################################
|
||||
# Testing login and signup by different kinds of users
|
||||
|
|
@ -14,23 +16,27 @@ class StoriesTest < ActionDispatch::IntegrationTest
|
|||
end
|
||||
|
||||
def test_signup_new_user_by_nonadmin
|
||||
SITE_CONFIG['open_signups'] = false
|
||||
other_user = new_session_as(:other_user,"sesame")
|
||||
other_user.goes_to_signup_as_nonadmin
|
||||
stub_site_config do
|
||||
SITE_CONFIG['open_signups'] = false
|
||||
other_user = new_session_as(:other_user,"sesame")
|
||||
other_user.goes_to_signup_as_nonadmin
|
||||
end
|
||||
end
|
||||
|
||||
def test_open_signup_new_user
|
||||
SITE_CONFIG['open_signups'] = true
|
||||
get "/signup"
|
||||
assert_response :success
|
||||
assert_template "users/new"
|
||||
post "/users", :user => {:login => "newbie",
|
||||
:password => "newbiepass",
|
||||
:password_confirmation => "newbiepass"}
|
||||
assert_response :redirect
|
||||
follow_redirect!
|
||||
assert_response :success
|
||||
assert_template "todos/index"
|
||||
stub_site_config do
|
||||
SITE_CONFIG['open_signups'] = true
|
||||
get "/signup"
|
||||
assert_response :success
|
||||
assert_template "users/new"
|
||||
post "/users", :user => {:login => "newbie",
|
||||
:password => "newbiepass",
|
||||
:password_confirmation => "newbiepass"}
|
||||
assert_response :redirect
|
||||
follow_redirect!
|
||||
assert_response :success
|
||||
assert_template "todos/index"
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue