thoughtbot / vim-rspec

Run Rspec specs from Vim
https://robots.thoughtbot.com
MIT License
656 stars 108 forks source link

Backfill test cases which depend on knowing if the current file is a spec file or not #124

Closed dgmstuart closed 7 years ago

dgmstuart commented 7 years ago

Looking at the specs it seemed like there were some missing test cases, and some superfluous test cases.

This PR adds in test coverage for the scenarios where the context is currently a spec file, and deletes some test cases which refer to variables not actually used in the code.

Arguably the tests which assert that variables are set (e.g. Expect Ref("s:last_spec_file") == "controller_spec.rb") are testing implementation details rather than behaviour.

An alternative way of writing this would be to have integration tests which e.g. assert that if RunLastSpec is called after RunCurrentTestFile then the correct file gets run.

This is my first attempt at writing vspec tests, so please let me know if the style isn't right.

gylaz commented 7 years ago

This looks great @dgmstuart! Mind squashing down to one commit?

dgmstuart commented 7 years ago

Sure!

dgmstuart commented 7 years ago

@gylaz done

gylaz commented 7 years ago

Thanks again, @dgmstuart!