Sha256: a9e44b640cfe2466b1f9f8cfb46dad4e0a5167d4f86fcd6d21dbefd09bb5485c

Contents?: true

Size: 1.11 KB

Versions: 23

Compression:

Stored size: 1.11 KB

Contents

# https://relishapp.com/rspec/rspec-core/v/3-6/docs/example-groups/shared-examples
RSpec.shared_examples "plugin_tests" do |parameter|
  let(:plugin) do
    instance = PuppetDebugger::InputResponders::Commands.plugin_from_command(subject.to_s).instance
    instance.debugger = debugger
    instance
  end

  let(:output) do
    StringIO.new
  end

  let(:debugger) do
    PuppetDebugger::Cli.new({ out_buffer: output }.merge(options))
  end

  let(:options) do
    {}
  end

  it "commands contant is an array" do
    expect(plugin.class::COMMAND_WORDS).to be_a(Array)
  end

  it "commands must contain at least one word" do
    expect(plugin.class::COMMAND_WORDS.count).to  be > 0
  end

  it "summary must be a string" do
    expect(plugin.class::SUMMARY).to be_a(String)
  end

  it 'implements run' do
    expect{plugin.run([])}.not_to raise_error(NotImplementedError)
  end

  it 'be looked up via any command words' do
    plugin.class::COMMAND_WORDS.each do |word|
      actual = PuppetDebugger::InputResponders::Commands.plugin_from_command(word.to_s).instance.class
      expect(actual).to eq(plugin.class)
    end
  end

end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
puppet-debugger-0.19.0 lib/puppet-debugger/plugin_test_helper.rb
puppet-debugger-0.18.0 lib/puppet-debugger/plugin_test_helper.rb
puppet-debugger-0.17.0 lib/puppet-debugger/plugin_test_helper.rb
puppet-debugger-0.16.0 lib/puppet-debugger/plugin_test_helper.rb
puppet-debugger-0.15.2 lib/puppet-debugger/plugin_test_helper.rb
puppet-debugger-0.15.1 lib/puppet-debugger/plugin_test_helper.rb
puppet-debugger-0.15.0 lib/puppet-debugger/plugin_test_helper.rb
puppet-debugger-0.14.0 lib/puppet-debugger/plugin_test_helper.rb
puppet-debugger-0.13.0 lib/puppet-debugger/plugin_test_helper.rb
puppet-debugger-0.12.3 lib/puppet-debugger/plugin_test_helper.rb
puppet-debugger-0.12.2 lib/puppet-debugger/plugin_test_helper.rb
puppet-debugger-0.12.1 lib/puppet-debugger/plugin_test_helper.rb
puppet-debugger-0.12.0 lib/puppet-debugger/plugin_test_helper.rb
puppet-debugger-0.11.0 lib/puppet-debugger/plugin_test_helper.rb
puppet-debugger-0.10.3 lib/puppet-debugger/plugin_test_helper.rb
puppet-debugger-0.10.2 lib/puppet-debugger/plugin_test_helper.rb
puppet-debugger-0.10.1 lib/puppet-debugger/plugin_test_helper.rb
puppet-debugger-0.10.0 lib/puppet-debugger/plugin_test_helper.rb
puppet-debugger-0.9.1 lib/puppet-debugger/plugin_test_helper.rb
puppet-debugger-0.9.0 lib/puppet-debugger/plugin_test_helper.rb