Test for bug #4524 and bug #4587 to verify that resources are available w/in rspec constructs.

Signed-off-by: Ryan Davis <zenspider@chef.io>
This commit is contained in:
Ryan Davis 2019-10-31 02:04:04 -07:00
parent 02913c45e5
commit defe63dada
2 changed files with 33 additions and 0 deletions

View file

@ -34,6 +34,8 @@ module Inspec
attr_reader :backend, :rules
attr_accessor :target_profiles
attr_accessor :test_collector
def attributes
Inspec.deprecate(:rename_attributes_to_inputs, "Don't call runner.attributes, call runner.inputs")
inputs

View file

@ -3,10 +3,41 @@
require "helper"
require "inspec/secrets"
require "inspec/runner"
require "fetchers/mock"
describe Inspec::Runner do
let(:runner) { Inspec::Runner.new({ command_runner: :generic }) }
it "bug #4524" do
file = <<-RUBY
describe "a thing" do
before(:all) { command("true") }
it("should pass") {}
end
RUBY
runner.add_target("bug4524.rb" => file)
runner.load
result = RSpec::Core::Runner.new(nil).run_specs(runner.test_collector.tests)
_(result).must_equal 0
end
it "bug #4587" do
file = <<-RUBY
describe "a thing" do
subject! { command("true") }
its("exit_status") { should eq 0 }
end
RUBY
runner.add_target("bug4587.rb" => file)
runner.load
result = RSpec::Core::Runner.new(nil).run_specs(runner.test_collector.tests)
_(result).must_equal 0
end
# =============================================================== #
# Reporter Options
# =============================================================== #