-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert tests to RSpec #117
Conversation
This test originally covered #86.
Wow. Finished. Let me know what you think @jasoncodes. |
This looks really nice! I'm looking into adding test coverage to another shell script: https://github.com/virtualhost/virtualhost.sh. Could you share your main reason(s) for switching to RSpec? I'm guessing one would be that shunit2 looks to be abandoned but I'm also wondering if you've found the experience to be a positive one. I've always loved that fresh has test coverage so I've been following this PR with great interest :) |
@cottser There are a few reasons for changing. The first is simply for organisation, describe/context blocks mean we can group related tests together. I also find it easier to add helper methods to make the test readability better. Having access to thing like active support's Another reason is the error messages we get. I find coloured diffs much easier to parse. I also find RSpec's Ruby's I'd recommend it if you're going to have more than a dozen tests. It was nice having the tests in the same language as the actual code but I think this is going to be easier going forward. |
Awesome, thank you very much for the response @twe4ked! I will be digging into this code in the near future to learn as much as I can. |
No worries, Another two options to look at are bats and shpec. We decided against shpec because of this open issue: rylnd/shpec#15. I don't think we ever really looked into Bats properly. |
Closes #117 * rspec: (75 commits) Ensure setting FRESH_NO_BIN_CHECK disables check Improve example names Reorder tests Colourful tests Always return a string from `expect_shell_sh` Prefer `unless foo` over `if !foo` Use Hash#fetch for default values Assert valid options keys to test helper methods Fix require name Add pry to assist with debugging Use `expect(pathname).to exist` over `expect(File).to exist(pathname)` Remove .gitignore Remove shUnit2 related files Convert _parse_fresh_dsl_args tests Convert private function tests Use FileUtils chmod method Convert subcommand tests Convert fresh-options tests Convert "edit" tests Convert tests for adding fresh lines interactively ...
@cottser Looks like there is some work happening on shpec that might be interesting. If they have an |
Nice, thanks @twe4ked :) |
No description provided.