Unit/Integration Tests for Scripts

Shopify Partner
1 0 0

Whats the general recommendation when developing scripts to add some integration/unit tests to show they work?  There doesnt seem to be any obvious way or solutions out there. I generally use rails/rspec for development so thats an aproach I would like to take.

As a potential solution I was thinking about using the shopify_app gem and then maybe add my scripts manually as classes and then just pass a cart object to the scripts and test the results.  This doesnt seem viable as not testing like for like.

Anyone got any recommendations?