Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where can I find good examples of testing a Thor script with RSpec?

Tags:

rspec

thor

Where can I find good examples of testing a Thor script with RSpec?

My searches have so far not turned up anything good.

like image 852
iconoclast Avatar asked Aug 15 '11 05:08

iconoclast


People also ask

How do I run an rspec test?

Running tests by their file or directory names is the most familiar way to run tests with RSpec. RSpec can take a file name or directory name and run the file or the contents of the directory. So you can do: rspec spec/jobs to run the tests found in the jobs directory.

What is rspec testing?

RSpec is a testing tool for Ruby, created for behavior-driven development (BDD). It is the most frequently used testing library for Ruby in production applications. Even though it has a very rich and powerful DSL (domain-specific language), at its core it is a simple tool which you can start using rather quickly.


2 Answers

Try out Thor's own repo at https://github.com/wycats/thor/tree/master/spec

like image 195
argent_smith Avatar answered Sep 20 '22 05:09

argent_smith


I'm trying to do rspec tests for thor in my homedir project (in the homedir3 branch, at the moment). Look in the CLI_spec.rb file.

I don't claim they are the paragon of unit tests but it's something to look at.

like image 38
docwhat Avatar answered Sep 21 '22 05:09

docwhat