Debug and execute inspec with Rubymine

Hello,

at work i want to write some test in ruby and inspec. I find the develop environment “Rubymine”, but i’ve some problems to setup Rubymine with inspec. Rubymine give you the opportunity to run ruby on a internal console, but in the console don’t work inspec commands/scripts like this:

describe file('Source.txt') do
  it { should exist }
  its ('content') {should match 'Test'}
end

It’s possible to run this script direct on the internal terminal from Rubymine without typing “inspec exec check.rb”? And how can i use the debugger for inspec commands?

Many thanks in advance.

I’m not familiar with Rubymine, so I can’t advise you on that. However, I can say that the Byebug gem has been used effectively to debug both InSpec core code and control code.

After installing the gem, you typically run it by finding the point you want insight into, and adding

require 'byebug'; byebug

That will halt execution at that point, and then you can step through, set breakpoints, print values, etc.