Module: Dry::Plugins::RSpec
- Defined in:
- lib/rspec/dry-plugins.rb
Overview
RSpec helpers for plug-ins
Instance Method Summary collapse
- #a_plugins_host(name: :ExamplePluginsHost, parent: nil, &block) ⇒ Object
- #an_example_class(name: :Example, parent: nil, &block) ⇒ Object
Instance Method Details
#a_plugins_host(name: :ExamplePluginsHost, parent: nil, &block) ⇒ Object
39 40 41 42 43 44 |
# 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) ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# 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 |