Skip to content

Commit

Permalink
♻️ Refactor test requires for proper load order
Browse files Browse the repository at this point in the history
  • Loading branch information
pboling committed Sep 20, 2024
1 parent 9c60f23 commit bdb124d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 14 deletions.
6 changes: 0 additions & 6 deletions test/helper.rb

This file was deleted.

7 changes: 7 additions & 0 deletions test/support/logging.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require "logger"

module TestLogging
LOGGER = Logger.new($stdout)
end

TestLogging::LOGGER.level = Logger::WARN
20 changes: 14 additions & 6 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# External dependencies
require "byebug" if ENV.fetch("DEBUG", "false").casecmp?("true")
require "net/http"
require "rack"
require "rack/session"

# testing libraries
require "minitest/rg"

# Test support
require "support/logging"

## Last thing before loading this gem is to setup code coverage
begin
Expand All @@ -11,12 +20,11 @@
nil
end

# Testing libraries
# Testing libraries that need to load after simplecov
require "minitest/autorun"
require "minitest/rg"
require "net/http"
require "rack"
require "rack/session"

# Internal dependencies & mixins
require_relative "helper"
require "rack/openid"
require "rack/openid/simple_auth"

OpenID::Util.logger = TestLogging::LOGGER
5 changes: 3 additions & 2 deletions test/test_integration.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# External libraries
require "rots"

require_relative "test_helper"

describe "integration" do
Expand Down Expand Up @@ -30,8 +33,6 @@ def fetch(url, body = nil, headers = nil, limit = nil)
ROTS_SERVER_URL = "http://localhost:9292"

RotsApp = Rack::Builder.new do
require "rots"

config = {
"identity" => "john.doe",
"sreg" => {
Expand Down

0 comments on commit bdb124d

Please sign in to comment.