diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-04-28 19:50:06 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-04-28 19:50:06 +0000 |
commit | 4fbb9aa3cb6c31ec128bfb31f59efa66d66adba4 (patch) | |
tree | 84a654b260261fe172f2584f60b3ba93e59f841d /spec/ruby/library/coverage | |
parent | b864bd05bff2a61d55b08deb92e969f9fa55e07c (diff) | |
download | ruby-4fbb9aa3cb6c31ec128bfb31f59efa66d66adba4.tar.gz |
Update to ruby/spec@6f38a82
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63293 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/library/coverage')
-rw-r--r-- | spec/ruby/library/coverage/peek_result_spec.rb | 102 |
1 files changed, 50 insertions, 52 deletions
diff --git a/spec/ruby/library/coverage/peek_result_spec.rb b/spec/ruby/library/coverage/peek_result_spec.rb index f10e85828e..897fc4d978 100644 --- a/spec/ruby/library/coverage/peek_result_spec.rb +++ b/spec/ruby/library/coverage/peek_result_spec.rb @@ -2,66 +2,64 @@ require_relative '../../spec_helper' require fixture __FILE__, 'spec_helper' require 'coverage' -ruby_version_is '2.3' do - describe 'Coverage.peek_result' do - before :all do - @class_file = fixture __FILE__, 'some_class.rb' - @second_class_file = fixture __FILE__, 'second_class.rb' - end +describe 'Coverage.peek_result' do + before :all do + @class_file = fixture __FILE__, 'some_class.rb' + @second_class_file = fixture __FILE__, 'second_class.rb' + end - after :each do - $LOADED_FEATURES.delete(@class_file) - $LOADED_FEATURES.delete(@second_class_file) - end + after :each do + $LOADED_FEATURES.delete(@class_file) + $LOADED_FEATURES.delete(@second_class_file) + end - it 'returns the result so far' do - Coverage.start - require @class_file.chomp('.rb') - result = Coverage.peek_result - Coverage.result + it 'returns the result so far' do + Coverage.start + require @class_file.chomp('.rb') + result = Coverage.peek_result + Coverage.result - result.should == { - @class_file => [ - nil, nil, 1, nil, nil, 1, nil, nil, 0, nil, nil, nil, nil, nil, nil, nil - ] - } - end + result.should == { + @class_file => [ + nil, nil, 1, nil, nil, 1, nil, nil, 0, nil, nil, nil, nil, nil, nil, nil + ] + } + end - it 'immediate second call returns same result' do - Coverage.start - require @class_file.chomp('.rb') - result1 = Coverage.peek_result - result2 = Coverage.peek_result - Coverage.result + it 'immediate second call returns same result' do + Coverage.start + require @class_file.chomp('.rb') + result1 = Coverage.peek_result + result2 = Coverage.peek_result + Coverage.result - result2.should == result1 - end + result2.should == result1 + end - it 'second call after require returns accumulated result' do - Coverage.start - require @class_file.chomp('.rb') - Coverage.peek_result - require @second_class_file.chomp('.rb') - result = Coverage.peek_result - Coverage.result + it 'second call after require returns accumulated result' do + Coverage.start + require @class_file.chomp('.rb') + Coverage.peek_result + require @second_class_file.chomp('.rb') + result = Coverage.peek_result + Coverage.result - result.should == { - @class_file => [ - nil, nil, 1, nil, nil, 1, nil, nil, 0, nil, nil, nil, nil, nil, nil, nil - ], - @second_class_file => [ - 1, 1, 0, nil, nil - ] - } - end + result.should == { + @class_file => [ + nil, nil, 1, nil, nil, 1, nil, nil, 0, nil, nil, nil, nil, nil, nil, nil + ], + @second_class_file => [ + 1, 1, 0, nil, nil + ] + } + end - it 'call right before Coverage.result should give equal result' do - Coverage.start - require @class_file.chomp('.rb') - result1 = Coverage.peek_result - result2 = Coverage.result + it 'call right before Coverage.result should give equal result' do + Coverage.start + require @class_file.chomp('.rb') + result1 = Coverage.peek_result + result2 = Coverage.result - result1.should == result2 - end + result1.should == result2 end end |