You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Lemon can also be used to generate test scaffolding for pre-existing code. For example:
$ lemon -g -a -n HelloWorld lib/hello_world.rb
The -a (or --all) option tells Lemon to generate test code for all classes and modules in the system (as opposed to classes and modules with testcases already started). Obviously we don’t actually want a test for every method of every class or module, so we use the -n (or --namespace) filter option to focus on the class of interest.
Generated tests can also be limited to just the units not yet covered by eliminating the -a option and passing in pre-existing test scripts instead.
$ lemon -g test/case_hello_world.rb
Notice we no longer need to use the -n filter either since our test case is being used as the limiting factor.