Sha256: e7c96f26d4a0de4f18b81695a16d6fccb960819df00e34de8ea2b7abb396d756

Contents?: true

Size: 1.72 KB

Versions: 8

Compression:

Stored size: 1.72 KB

Contents

# encoding: UTF-8

require 'spec_helper'

describe Gjp::JarTable do
  let(:dir) { File.join("spec", "data", "ant-super-simple-code") }
  let(:jar_table) { Gjp::JarTable.new(dir, true) }

  describe "#get_jars" do
    it "finds jar paths in a directory" do 
      jar_table.get_jars(dir).should include(
        File.join(dir, "dist", "antsimple-20130618.jar"),
        File.join(dir, "lib", "junit-4.11.jar"),
        File.join(dir, "lib", "log4j-1.2.13.jar")
      )
    end
  end

  describe "#get_jar_defined_packages" do
    it "finds the package names part of a jar file" do 
      jar_table.get_jar_defined_packages(File.join(dir, "lib", "junit-4.11.jar")).should include(
        "junit.framework",
        "junit.extensions",
        "org.junit.runner",
        "org.junit.runners.model"
      )
    end
  end

  describe "#sources" do
    it "finds source paths in a directory" do 
      jar_table.get_sources(dir).should include(
        File.join(dir, "src", "mypackage", "HW.java")
      )
    end
  end

  describe "#source_defined_packages" do
    it "finds the package names built from this project" do 
      jar_table.source_defined_packages.should include("mypackage")
    end
  end

  describe "#runtime_required_packages" do
    it "finds the package names required by this project's sources" do 
      jar_table.runtime_required_packages.should include("org.apache.log4j")
    end
  end

  describe "#rows" do
    it "returns jar data" do
      jar_table.rows.should include(
        "spec/data/ant-super-simple-code/lib/log4j-1.2.13.jar" => :required,
        "spec/data/ant-super-simple-code/lib/junit-4.11.jar" => :build_required,
        "spec/data/ant-super-simple-code/dist/antsimple-20130618.jar" => :produced
      )
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
gjp-0.16.1 spec/lib/jar_table_spec.rb
gjp-0.16.0 spec/lib/jar_table_spec.rb
gjp-0.15.7 spec/lib/jar_table_spec.rb
gjp-0.14.1 spec/lib/jar_table_spec.rb
gjp-0.13.1 spec/lib/jar_table_spec.rb
gjp-0.11.2 spec/lib/jar_table_spec.rb
gjp-0.11.1 spec/lib/jar_table_spec.rb
gjp-0.10.0 spec/lib/jar_table_spec.rb