diff --git a/library/coverage/code_with_begin_spec.rb b/library/coverage/code_with_begin_spec.rb new file mode 100644 index 0000000000..3d5fc49637 --- /dev/null +++ b/library/coverage/code_with_begin_spec.rb @@ -0,0 +1,24 @@ +require_relative '../../spec_helper' +require 'coverage' + +describe 'Coverage for the code with begin' do + before :all do + @file = fixture __FILE__, 'code_with_begin.rb' + end + + after :each do + $LOADED_FEATURES.delete(@file) + end + + it 'covers 100% lines' do + Coverage.start + require @file.chomp('.rb') + result = Coverage.result + + result.should == { + @file => [ + nil, 1, nil + ] + } + end +end diff --git a/library/coverage/fixtures/code_with_begin.rb b/library/coverage/fixtures/code_with_begin.rb new file mode 100644 index 0000000000..370b0b74d5 --- /dev/null +++ b/library/coverage/fixtures/code_with_begin.rb @@ -0,0 +1,3 @@ +begin + puts 'begin' +end