2017-07-24 16:20:53 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-02-19 11:50:42 -05:00
|
|
|
require "abstract_unit"
|
|
|
|
require "capybara/dsl"
|
|
|
|
require "action_dispatch/system_testing/server"
|
|
|
|
|
|
|
|
class ServerTest < ActiveSupport::TestCase
|
2018-04-06 18:18:16 -04:00
|
|
|
setup do
|
|
|
|
@old_capybara_server = Capybara.server
|
|
|
|
end
|
|
|
|
|
2017-02-19 17:49:21 -05:00
|
|
|
test "port is always included" do
|
2017-12-09 16:46:31 -05:00
|
|
|
ActionDispatch::SystemTesting::Server.new.run
|
2017-02-19 17:49:21 -05:00
|
|
|
assert Capybara.always_include_port, "expected Capybara.always_include_port to be true"
|
|
|
|
end
|
2017-12-09 16:46:31 -05:00
|
|
|
|
|
|
|
test "server is changed from `default` to `puma`" do
|
|
|
|
Capybara.server = :default
|
|
|
|
ActionDispatch::SystemTesting::Server.new.run
|
2018-04-03 21:34:51 -04:00
|
|
|
assert_not_equal Capybara.server, Capybara.servers[:default]
|
2017-12-09 16:46:31 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
test "server is not changed to `puma` when is different than default" do
|
|
|
|
Capybara.server = :webrick
|
|
|
|
ActionDispatch::SystemTesting::Server.new.run
|
|
|
|
assert_equal Capybara.server, Capybara.servers[:webrick]
|
|
|
|
end
|
|
|
|
|
|
|
|
teardown do
|
2018-04-06 18:18:16 -04:00
|
|
|
Capybara.server = @old_capybara_server
|
2017-12-09 16:46:31 -05:00
|
|
|
end
|
2017-02-19 11:50:42 -05:00
|
|
|
end
|