File: coverage_for_eval_spec.rb

package info (click to toggle)
ruby-simplecov 0.22.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,500 kB
  • sloc: ruby: 5,550; makefile: 10
file content (26 lines) | stat: -rw-r--r-- 581 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# frozen_string_literal: true

require "helper"

RSpec.describe "coverage for eval" do
  if SimpleCov.coverage_for_eval_supported?
    around do |test|
      Dir.chdir(File.join(File.dirname(__FILE__), "fixtures", "eval_test")) do
        FileUtils.rm_rf("./coverage")
        test.call
      end
    end

    before do
      @stdout, @stderr, @status = Open3.capture3(command)
    end

    context "foo" do
      let(:command) { "#{RbConfig.ruby} eval_test.rb" }

      it "records coverage for erb" do
        expect(@stdout).to include(" 2 / 3 LOC")
      end
    end
  end
end