Module: RSpecRcv::RSpec::Metadata

Extended by:
Metadata
Included in:
Metadata
Defined in:
lib/rspec-rcv/test_frameworks/rspec.rb

Instance Method Summary collapse

Instance Method Details

#configure!Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/rspec-rcv/test_frameworks/rspec.rb', line 6

def configure!
  ::RSpec.configure do |config|
    when_tagged_with_rcv = { rcv: lambda { |val| !!val } }

    config.after(:each, when_tagged_with_rcv) do |ex|
      example = ex.respond_to?(:metadata) ? ex : ex.example
      opts = example.[:rcv]
      data_proc = lambda { |opts| instance_eval(&opts[:exportable_proc]) }

      Handler.new(ex.file_path, data_proc, metadata: opts).call
    end
  end
end