Sha256: 7bf400d4a23d14cb11a8622f2819932c6b4436aa239a2ebf11a69d20251fa5d8

Contents?: true

Size: 1.81 KB

Versions: 10

Compression:

Stored size: 1.81 KB

Contents

# frozen_string_literal: true

require_relative "../spec_helper"

module CheckstyleReports::Entity
  FILE_NODE_SAMPLE_1 = <<NODE
<file
  name="/Users/jmatsu/Workspace/sample/src/main/java/io/github/jmatsu/Sample.java" >
  #{ERROR_NODE_SAMPLE_1}
</file>
NODE

  FILE_NODE_SAMPLE_2 = <<NODE
<file
  name="/Users/jmatsu/Workspace/sample/src/test/java/io/github/jmatsu/Sample2.java" >
  #{ERROR_NODE_SAMPLE_1}
  #{ERROR_NODE_SAMPLE_2}
</file>
NODE

  FILE_NODE_SAMPLE_EMPTY = <<NODE
<file
  name="/Users/jmatsu/Workspace/sample/src/main/java/io/github/jmatsu/Sample.java" />
NODE

  describe CheckstyleReports::Entity::FoundFile do
    let(:file) { FoundFile.new(REXML::Document.new(node).root, prefix: "/Users/jmatsu/Workspace/sample") }

    context "sample1" do
      let(:node) { FILE_NODE_SAMPLE_1 }

      it "should read it successfully" do
        expect(file.path).to eq("/Users/jmatsu/Workspace/sample/src/main/java/io/github/jmatsu/Sample.java")
        expect(file.errors.size).to eq(1)
        expect(file.relative_path).to eq("src/main/java/io/github/jmatsu/Sample.java")
      end
    end

    context "sample2" do
      let(:node) { FILE_NODE_SAMPLE_2 }

      it "should read it successfully" do
        expect(file.path).to eq("/Users/jmatsu/Workspace/sample/src/test/java/io/github/jmatsu/Sample2.java")
        expect(file.errors.size).to eq(2)
        expect(file.relative_path).to eq("src/test/java/io/github/jmatsu/Sample2.java")
      end
    end

    context "sample empty" do
      let(:node) { FILE_NODE_SAMPLE_EMPTY }

      it "should read it successfully" do
        expect(file.path).to eq("/Users/jmatsu/Workspace/sample/src/main/java/io/github/jmatsu/Sample.java")
        expect(file.errors.size).to eq(0)
        expect(file.relative_path).to eq("src/main/java/io/github/jmatsu/Sample.java")
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
danger-space_checkstyle_reports-1.0.3 spec/entity/found_file_spec.rb
danger-space_checkstyle_reports-1.0.2 spec/entity/found_file_spec.rb
ktlint_reporter-1.0.1 spec/entity/found_file_spec.rb
ktlint_reporter-1.0.0 spec/entity/found_file_spec.rb
ktlint_reporter-0.1.2 spec/entity/found_file_spec.rb
ktlint_reporter-0.1.1 spec/entity/found_file_spec.rb
ktlint_reporter-0.1.0 spec/entity/found_file_spec.rb
danger-checkstyle_reports-0.1.0 spec/entity/found_file_spec.rb
danger-checkstyle_reports-0.0.1.pre.rc02 spec/entity/found_file_spec.rb
danger-checkstyle_reports-0.0.1.pre.rc01 spec/entity/found_file_spec.rb