Sha256: 338af4e906293be35e453d2bd05ba794988ac8c3c0c88d12dfc6eae4ef26cd94
Contents?: true
Size: 1.13 KB
Versions: 1
Compression:
Stored size: 1.13 KB
Contents
# frozen_string_literal: true require 'rspec' require 'rspec/its' require 'dry-plugins' require 'dry/core/class_builder' RSpec.shared_context 'a plug-ins host' do subject(:host) { described_class } it { is_expected.to respond_to :use } it { is_expected.to respond_to :used_plugins } it { is_expected.to respond_to :plugins } it { is_expected.to respond_to Dry::Plugins.config.registry_method } describe ".const_get #{Dry::Plugins.config.plugins_module_name.inspect}" do subject(:plugins) { host.const_get(Dry::Plugins.config.plugins_module_name) } it { is_expected.to be_a Module } it { is_expected.to respond_to Dry::Plugins.config.registry_method } end end module Dry module Plugins # RSpec helpers for plug-ins module RSpec def a_plugins_host(name: :Host, 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 end end end RSpec.configure do |config| config.include Dry::Plugins::RSpec end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dry-plugins-0.1.0 | lib/rspec/dry-plugins.rb |