summaryrefslogtreecommitdiff
path: root/spec/ruby
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby')
-rw-r--r--spec/ruby/library/coverage/result_spec.rb23
1 files changed, 18 insertions, 5 deletions
diff --git a/spec/ruby/library/coverage/result_spec.rb b/spec/ruby/library/coverage/result_spec.rb
index 6cf5be1346..4cc43e8462 100644
--- a/spec/ruby/library/coverage/result_spec.rb
+++ b/spec/ruby/library/coverage/result_spec.rb
@@ -65,12 +65,25 @@ describe 'Coverage.result' do
result.should == {}
end
- it 'second Coverage.start does nothing' do
- Coverage.start
- require @config_file.chomp('.rb')
- result = Coverage.result
+ ruby_version_is ''...'3.1' do
+ it 'second Coverage.start does nothing' do
+ Coverage.start
+ require @config_file.chomp('.rb')
+ result = Coverage.result
+
+ result.should == { @config_file => [1, 1, 1] }
+ end
+ end
- result.should == { @config_file => [1, 1, 1] }
+ ruby_version_is '3.1' do
+ it 'second Coverage.start give exception' do
+ Coverage.start
+ -> {
+ require @config_file.chomp('.rb')
+ }.should raise_error(RuntimeError, 'coverage measurement is already setup')
+ ensure
+ Coverage.result
+ end
end
it 'does not include the file starting coverage since it is not tracked' do