require 'spec_helper' class NamedExample # @rspec_example can be executed def a_method end end describe NamedExample do describe '#a_method' do it 'can be executed' do NamedExample.new.a_method end end end describe NamedExample do subject do -> { YARD.parse(__FILE__) output = YARD::Registry.all(:class).find { |i| i.to_s == 'NamedExample' } YARD::Templates::Engine.render(OPTIONS.merge(:object => output)) } end it { is_expected.not_to output.to_stdout } end