Sha256: 796f463c5193216c56a2c0246682fb818d458baefc3fedf592570ed17dd9b2e8

Contents?: true

Size: 1.36 KB

Versions: 12

Compression:

Stored size: 1.36 KB

Contents

require "helper"

if SimpleCov.usable?
  describe SimpleCov::Result do
    subject do
      original_result = {
        source_fixture("sample.rb") => [nil, 1, 1, 1, nil, nil, 1, 1, nil, nil],
        source_fixture("app/models/user.rb") => [nil, 1, 1, 1, nil, nil, 1, 0, nil, nil],
        source_fixture("app/controllers/sample_controller.rb") => [nil, 2, 2, 0, nil, nil, 0, nil, nil, nil],
      }
      SimpleCov::Result.new(original_result).files
    end

    it "has 11 covered lines" do
      expect(subject.covered_lines).to eq(11)
    end

    it "has 3 missed lines" do
      expect(subject.missed_lines).to eq(3)
    end

    it "has 17 never lines" do
      expect(subject.never_lines).to eq(17)
    end

    it "has 14 lines of code" do
      expect(subject.lines_of_code).to eq(14)
    end

    it "has 5 skipped lines" do
      expect(subject.skipped_lines).to eq(5)
    end

    it "has the correct covered percent" do
      expect(subject.covered_percent).to eq(78.57142857142857)
    end

    it "has the correct covered percentages" do
      expect(subject.covered_percentages).to eq([50.0, 80.0, 100.0])
    end

    it "has the correct least covered file" do
      expect(subject.least_covered_file).to match(/sample_controller.rb/)
    end

    it "has the correct covered strength" do
      expect(subject.covered_strength).to eq(0.9285714285714286)
    end
  end
end

Version data entries

12 entries across 12 versions & 5 rubygems

Version Path
tdiary-5.0.9 vendor/bundle/gems/simplecov-0.14.1/spec/file_list_spec.rb
simplecov-0.15.1 spec/file_list_spec.rb
simplecov-0.15.0 spec/file_list_spec.rb
logstash-filter-cache-redis-0.3.1 vendor/bundle/jruby/1.9/gems/simplecov-0.14.1/spec/file_list_spec.rb
logstash-filter-cache-redis-0.3.0 vendor/bundle/jruby/1.9/gems/simplecov-0.14.1/spec/file_list_spec.rb
logstash-filter-cache-redis-0.2.0 vendor/bundle/jruby/1.9/gems/simplecov-0.14.1/spec/file_list_spec.rb
logstash-filter-cache-redis-0.1.0 vendor/bundle/jruby/1.9/gems/simplecov-0.14.1/spec/file_list_spec.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/simplecov-0.14.1/spec/file_list_spec.rb
simplecov-patched-0.14.3 spec/file_list_spec.rb
simplecov-patched-0.14.2 spec/file_list_spec.rb
simplecov-0.14.1 spec/file_list_spec.rb
simplecov-0.14.0 spec/file_list_spec.rb