Sha256: ef9f77ccb0c0303cdb84fbbb9bf00616d5d399c1e2095002347f0ffea2cbb872

Contents?: true

Size: 1.74 KB

Versions: 18

Compression:

Stored size: 1.74 KB

Contents

require_relative '../spec_helper'
require 'yaml'
require 'maven/tools/dsl/gemspec'
require 'maven/tools/project'
require 'maven/tools/model'
require 'maven/tools/dsl'
require 'maven/tools/visitor'

class Maven::Tools::Project
  include Maven::Tools::DSL
end

class GemspecFile
  def self.read( name, artifact_id )
    xml = File.read( __FILE__.sub( /.rb$/, "/#{name}" ) )
    xml.gsub!( /BASEDIR/, artifact_id )
    xml
  end

end

describe Maven::Tools::DSL::Gemspec do

  let( :parent ) { Maven::Tools::Project.new( __FILE__.sub( /.rb$/, '/maven-tools.gemspec' ) ) }

  subject { Maven::Tools::DSL::Gemspec }

  it 'evals maven_tools.gemspec' do
    parent = Maven::Tools::Project.new
    subject.new parent
    xml = ""
    Maven::Tools::Visitor.new( xml ).accept_project( parent.model )
    xml.must_equal( GemspecFile.read( 'maven-tools.xml', 'maven-tools'  ) )
  end

  it 'evals maven_tools.gemspec from yaml' do
    subject.new parent, 'maven-tools.gemspec'
    xml = ""
    Maven::Tools::Visitor.new( xml ).accept_project( parent.model )
    xml.must_equal( GemspecFile.read( 'maven-tools.xml', 'gemspec_spec' ) )
  end

  it 'evals gemspec with jar and pom dependencies' do
    subject.new parent, 'jars_and_poms.gemspec'
    xml = ""
    Maven::Tools::Visitor.new( xml ).accept_project( parent.model )
    xml.must_equal( GemspecFile.read( 'jars_and_poms.xml',
                                  'gemspec_spec' ) )
  end

  it 'evals gemspec with jar and pom dependencies' do
    subject.new parent, :name => 'jars_and_poms.gemspec', :include_jars => true
    xml = ""
    Maven::Tools::Visitor.new( xml ).accept_project( parent.model )
    xml.must_equal( GemspecFile.read( 'jars_and_poms_include_jars.xml',
                                  'gemspec_spec' ) )
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
maven-tools-1.2.1 spec/dsl/gemspec_spec.rb
maven-tools-1.2.0 spec/dsl/gemspec_spec.rb
maven-tools-1.2.0.pre1 spec/dsl/gemspec_spec.rb
maven-tools-1.1.7 spec/dsl/gemspec_spec.rb
maven-tools-1.1.6 spec/dsl/gemspec_spec.rb
maven-tools-1.1.4 spec/dsl/gemspec_spec.rb
maven-tools-1.1.3 spec/dsl/gemspec_spec.rb
maven-tools-1.1.2 spec/dsl/gemspec_spec.rb
maven-tools-1.1.1 spec/dsl/gemspec_spec.rb
maven-tools-1.1.0 spec/dsl/gemspec_spec.rb
maven-tools-1.0.13 spec/dsl/gemspec_spec.rb
maven-tools-1.0.12 spec/dsl/gemspec_spec.rb
maven-tools-1.0.11 spec/dsl/gemspec_spec.rb
maven-tools-1.0.10 spec/dsl/gemspec_spec.rb
maven-tools-1.0.9 spec/dsl/gemspec_spec.rb
maven-tools-1.0.8 spec/dsl/gemspec_spec.rb
maven-tools-1.0.7 spec/dsl/gemspec_spec.rb
maven-tools-1.0.6 spec/dsl/gemspec_spec.rb