On 29 March 2017 at 05:13, Dan Fitzpatrick <dan / eparklabs.com> wrote:

> Im looking for a unit test system to test module methods. Testing I have
> done in the past with Rspec and Minitest have always been in the context of
> instantiating a class and testing the instance. To test a module, they
> appear to require that you include the module you want to test into a class
> and test the class. I want to just test module methods in isolation.
>
> For example, given the module:
>
>     module A
>       extend self
>
>       def add(x, y)
>         x + y
>       end
>
>     end
>
> Id like to test with something like this:
>
>     assert(4, A.add(3, 1))
>
> or
>
>     test(A.add(3, 1), expect: 4)
>
> I know I can write this scenario quickly but Id like other test types and
> test run reporting.
>
> Its quite possible that the existing test systems can do this but I have
> not discovered a good way to go about it. Any pointers would be appreciated.
>
> Thanks,
>
> Dan
>
>
Sounds like you've been cargo-culting your tests, instead of just.. you
know.. writing them. There's no obligation to have any of that sort of
complexity:

https://gist.github.com/phluid61/b3b22ede9f72350d1cb374de1ec2d97b

Cheers
-- 
  Matthew Kerwin
  http://matthew.kerwin.net.au/
(supressed text/html)
Unsubscribe: <mailto:ruby-talk-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>