Module UnionStationHooks::SpecHelper
In: src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/spec_helper.rb

Contains helper methods for use in unit tests across all the `union_station_hooks_*` gems.

@private

Methods

Public Class methods

Public Instance methods

Checks whether `initialize_debugging` enabled debugging mode.

Opens a debug shell. By default, the debug shell is opened in the current working directory. If the current module has the `prepare_debug_shell` method, that method is called before opening the debug shell. The method could, for example, change the working directory.

This method does not raise an exception if the debug shell exits with an error.

Returns the path of a specific UstRouter dump file. Requires that `@dump_dir` is set.

Asserts that something should eventually happen. This is done by checking that the given block eventually returns true. The block is called once every `check_interval` msec. If the block does not return true within `deadline_duration` secs, then an exception is raised.

Assert that the dump file eventually exists and that its contents eventually match the given regex.

Lookup the `passenger-config` command, either by respecting the `PASSENGER_CONFIG` environment variable, or by looking it up in `PATH`. If the command cannot be found, the current process aborts with an error message.

Looks for the passenger-config command in PATH, returning nil if not found.

Checks whether this union_station_hooks installation is a copy that is vendored into Passenger, and if so, returns the full path to the containing Passenger‘s passenger-config command.

To be called during initialization of the test suite.

Uses `find_passenger_config` to lookup a Passenger installation, and loads the Passenger Ruby support library associated with that installation. All the constants defined in the Passenger Ruby support library are loaded. In addition, checks whether the Passenger agent executable is installed. If not, the current process aborts with an error message.

Assert that the dump file (if it ever exists) its contents will never match the given regex.

Reads the contents of a specific UstRouter dump file. Requires that `@dump_dir` is set.

@raise SystemError Something went wrong during reading.

Asserts that something should never happen. This is done by checking that the given block never returns true. The block is called once every `check_interval` msec, until `deadline_duration` seconds have passed. If the block ever returns true, then an exception is raised.

Unit tests must undo the Bundler environment so that the gem‘s own Gemfile doesn‘t affect subprocesses that may have their own Gemfile.

Waits until the dump file exists. Raises an error if this doesn‘t become true within the default {eventually} timeout.

Writes the given content to the file at the given path. If or or more parent directories don‘t exist, then they are created.

[Validate]