Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backfill test cases depending on current file
Add some missing test cases and remove some superfluous ones: 1. Remove references to last_spec_line 2. Add a Spec for RunCurrentSpecFile when in a spec file 3. Spec for RunNearestSpec when in a spec file 4. Test that RunAllSpecs runs all specs Detail: 1. Remove references to last_spec_line The test for RunCurrentSpecFile included references to a variable 'last_spec_line', and two contexts to handle the case where it is set or not set. This variable seems to have never been referenced in the code. It looks like it was introduced in 6a39ba7, but only in the specs. My guess is that this was used in a previous attempted implementation of that PR (thoughtbot#79) and committed by mistake. 2. Add a Spec for RunCurrentSpecFile when in a spec file Approach: Create a new buffer and name it differently to the last_spec_file :bdelete! is used in the after block (as opposed to e.g. :close!) so that the buffer is actually deleted and new buffers can be created with the same name in other tests. Note: previously only the fallback case (calling RunCurrentSpecFile when not currently in a spec file) was covered by specs. 3. Spec for RunNearestSpec when in a spec file Approach: - Set up a spec buffer with a different file name to last_spec_file and last_spec_file_with_line - Write some lines into that buffer - Jump to some point in the middle of that file 4. Test that RunAllSpecs runs all specs Previously there was no test case for this. Approach: regardless of anything else which might be set (e.g. last_spec) this always runs 'spec' NOTE: we need to explicitly set g:rspec_command when asserting the resulting command, because by default the command differs depending on environment - e.g. the default terminal command first calls 'clear' in the terminal.
- Loading branch information