module Dry::Plugins::RSpec

RSpec helpers for plug-ins

Public Instance Methods

a_plugins_host(name: :ExamplePluginsHost, parent: nil, &block) click to toggle source
# File lib/rspec/dry-plugins.rb, line 39
def a_plugins_host(name: :ExamplePluginsHost, parent: nil, &block)
  an_example_class(name: name, parent: parent) do
    extend Dry::Plugins
    instance_exec(&block) if block_given?
  end
end
an_example_class(name: :Example, parent: nil, &block) click to toggle source
# File lib/rspec/dry-plugins.rb, line 28
def an_example_class(name: :Example, parent: nil, &block)
  class_builder = Dry::Core::ClassBuilder.new(
    name: name,
    namespace: ::Object,
    parent: parent
  )
  host = class_builder.call
  host.module_eval(&block) if block_given?
  host
end