lib/rspec/dry-plugins.rb in dry-plugins-0.1.0 vs lib/rspec/dry-plugins.rb in dry-plugins-0.2.0

- old
+ new

@@ -23,18 +23,25 @@ module Dry module Plugins # RSpec helpers for plug-ins module RSpec - def a_plugins_host(name: :Host, parent: nil, &block) + 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 + + def a_plugins_host(name: :ExamplePluginsHost, parent: nil, &block) + an_example_class(name: name, parent: parent) do + extend Dry::Plugins + instance_exec(&block) + end end end end end RSpec.configure do |config|