module CaptainHoog::Test::RSpec::TestCase

Attributes

plugin[R]

Public Instance Methods

with_plugin(plugin_name, config: nil, silence: false) { || ... } click to toggle source
# File lib/captain_hoog/test/rspec.rb, line 8
def with_plugin(plugin_name, config: nil, silence: false)
  before do
    cfg = config ? self.send(config) : {}
    cfg.merge!(env: { suppress_headline: silence }) if silence
    build_sandbox(plugin_name, cfg)
  end
  context "with plugin #{plugin_name}" do
    yield if block_given?
  end
end

Private Instance Methods

build_sandbox(plugin_name, cfg) click to toggle source
# File lib/captain_hoog/test/rspec.rb, line 21
def build_sandbox(plugin_name, cfg)
  plugin_code  = self.send(plugin_name)
  sandbox      = CaptainHoog::Test::Sandbox.new(plugin_code, cfg)
  sandbox.run
  @plugin      = sandbox.plugin
end