Set a custom name for spin serve command
- It makes it easier to check if the server is running
refactor rspec runner
Now that signals are handled by a self-pipe queue (ef645ca), the changes made in 7a3c665 (2 layers of SIGINT handling) make less sense. This commit introduces new SIGINT handling behavior: if a test is running, the test is exited. Otherwise, the server is exited. Other changes: 1. Move messages written to/read from queue into constants. 2. Add a "ready" state to indicate whether or not the server is ready for new tests or commands. 3. Reconnect signal traps to signal "handler" methods.
Now that our SIGINT/SIGQUIT are handled serially, it's impossible for the sigquit_handler method to be called while a previous test is still running. Therefore, we don't need to keep track of the child process's pid, and can remove the TestProcess class.
Fixes Ctrl-\ re-running the test twice
Use the self-pipe trick to make the signal handlers safe in Ruby 2.0
…esses Prevent multiple test processes from running
The presence of the @pid instance variable alone can be trusted to determine whether or not the test process is alive (there's no need to send a signal).
This fixes a bug where if Ctrl+\ (SIGQUIT) was pressed multiple times, multiple test processes were spawned. Other changes: * Fix bug where if Ctrl+\ was pressed before first tests pushed, "You have a nil object when you didn't expect it!" exception was raised * Add notification when Spin server is ready * Consolidate duplicate Process.wait calls into one location (Spin.fork_and_run)
2 layers of SIGINT handling
Changes made: * If the process receiving the SIGINT is *not* the Spin server process, the SIGINT is "bubbled up" by exiting. * If the process receiving the SIGINT *is* the Spin server process, it's first ignored. If a second SIGINT is received within the time window (5 seconds), the server exits. The overall effect of these changes is that when Ctrl+C is pressed, the child process (the test) exits, but leaves the server running.
With the custom "formatter", this makes messages from Spin easier to distinguish from test and hook output.
Compact `files_to_load` before checking if it's empty
My guard file is setup to run acceptance/<file>_spec.rb, controllers/<file>_rspec.rb and routing/<file>_routing_spec.rb, when <file> is saved. Some of my controllers have routing specs, some doesn't. In case they doesn't spin will raise an error, because it can't invoke `empty?` on nil. This patch compmacts the `files_to_load` list, before testing if it's empty. This fixes the problem described above.
Unify run outputs with inspect
Put RSpec trailing args after files to run