Sha256: a4416325772e0c4d7c086274c0f395e32704d8a2c47c24873bea31aad536d73e

Contents?: true

Size: 1.65 KB

Versions: 27

Compression:

Stored size: 1.65 KB

Contents

# encoding: UTF-8

require 'spec_helper'

describe Gjp::MavenWebsite do
  let(:site) { Gjp::MavenWebsite.new }

  describe "#search_by_sha1" do
    it "uses search.maven.org to look for poms by jar SHA1" do
      result = site.search_by_sha1("546b5220622c4d9b2da45ad1899224b6ce1c8830").first

      result["g"].should eq("antlr")
      result["a"].should eq("antlrall")
      result["v"].should eq("2.7.2")
    end
  end

  describe "#search_by_name" do
    it "uses search.maven.org to look for poms by keyword (name)" do
      result = site.search_by_name("jruby").first

      # not much to test here
      result.should_not be_nil
    end
  end

  describe "#search_by_group_id_and_artifact_id" do
    it "uses search.maven.org to look for poms by group and artifact id" do
      results = site.search_by_group_id_and_artifact_id("antlr", "antlrall")

      results.any? { |result| result["id"] == "antlr:antlrall:2.7.2" }.should be_true
    end
  end

  describe "#search_by_maven_id" do
    it "uses search.maven.org to look for poms by group id, artifact id and version" do
      result = site.search_by_maven_id("antlr", "antlrall", "2.7.2")

      result.first["id"].should eq("antlr:antlrall:2.7.2")
    end
  end

  describe "#get_maven_id_from" do
    it "uses search.maven.org to look for poms" do
      site.get_maven_id_from({"g" => 1, "a" => 2, "v" => 3}).should eq([1, 2, 3])
    end
  end

  describe "#download_pom" do
    it "gets a pom from search.maven.org" do
      dir_path = File.join("spec", "data", "antlr")
      pom_path = File.join(dir_path, "pom.xml")
      site.download_pom("antlr", "antlrall", "2.7.2").should eq(File.read(pom_path))
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
gjp-0.36.0 spec/lib/maven_website_spec.rb
gjp-0.35.0 spec/lib/maven_website_spec.rb
gjp-0.34.0 spec/lib/maven_website_spec.rb
gjp-0.33.0 spec/lib/maven_website_spec.rb
gjp-0.32.0 spec/lib/maven_website_spec.rb
gjp-0.31.0 spec/lib/maven_website_spec.rb
gjp-0.30.0 spec/lib/maven_website_spec.rb
gjp-0.29.0 spec/lib/maven_website_spec.rb
gjp-0.28.0 spec/lib/maven_website_spec.rb
gjp-0.27.0 spec/lib/maven_website_spec.rb
gjp-0.26.0 spec/lib/maven_website_spec.rb
gjp-0.25.0 spec/lib/maven_website_spec.rb
gjp-0.24.0 spec/lib/maven_website_spec.rb
gjp-0.23.0 spec/lib/maven_website_spec.rb
gjp-0.22.0 spec/lib/maven_website_spec.rb
gjp-0.21.0 spec/lib/maven_website_spec.rb
gjp-0.20.0 spec/lib/maven_website_spec.rb
gjp-0.19.0 spec/lib/maven_website_spec.rb
gjp-0.18.0 spec/lib/maven_website_spec.rb
gjp-0.17.1 spec/lib/maven_website_spec.rb