[rspec-users] Newbie testing questions

Ben Densmore lists at ruby-forum.com
Fri Jun 1 15:46:39 UTC 2012

I recently wrote my first gem and am now in the process of learning how
to write tests for it before I release.

My gem is pretty basic and really just has a few class files with some
methods for using GET  to an API that returns some JSON data.

I'm trying to come up with what I should be testing for, but to be
honest this is where testing has always stumped me.

If I have a class file that looks like the following:

module MyModule

    class MyClass < MyParentClass

      def search(keyword)



The method in this class uses the HTTParty gem and just does a get on
this URL which returns JSON.

Is it a valid use case to test for the keyword argument? I am not sure
if there is any benefit to testing this since it's so very basic. It's a
good experiment for me since I am so new to testing but I really want to
understand what specifically I should be testing.

Any guidance would be greatly appreicated.


Posted via http://www.ruby-forum.com/.

More information about the rspec-users mailing list