Example of using inspec as a library?

I'd like to use inspec as a library in my rspec tests (reason: I'd like to use 3rd party gems which don't ship with inspec), but I've no idea how to do so.

I got inspec installed via gem install inspec, and require 'inspec' works ... what do I include/require to use for example the aws_ec2_instance? Could somebody serve with an example? I haven't found in the docs and the tests are a bit cryptic for me - I'm not a Ruby developer, but I can get started on some breadcrumbs.

InSpec expects to execute an InSpec profile, not individual resources. So typically you would create a profile (file containing tests) and feed that to the InSpec test runner. You can find that in the inspec exec definition, here. Note that "target" is the path or URL to a test file.

Pulling in AWS resources would be accomplished by setting a dependency in your test profile on the inspec-aws resource pack.

Good luck!

Thanks for the heads up. This seems like something that's too complex for my Ruby skills currently. :open_mouth:
For now, I've settled with an alternative way of doing things which seems to work out.
I'm installing the inspec-bin gem and this way inspec is available via my OS's regular gem ecosystem which I can extend with 3rd party libs.