Sha256: f6144eb7fe213c2e12ad8a4fe7417b591db62787a5e2ccfdfe3aa2d788cffb12

Contents?: true

Size: 1.42 KB

Versions: 3

Compression:

Stored size: 1.42 KB

Contents

require 'test_helper'

class TestSpecification < Test::Unit::TestCase
  def setup
    remove_tmpdir!
    FileUtils.cp_r fixture_dir, tmp_dir


    @spec = Gem::Specification.new
    @spec.extend(Jeweler::Specification)
    @spec.set_jeweler_defaults(tmp_dir)
  end

  def teardown
    remove_tmpdir!
  end

  context "Gem::Specification with Jeweler monkey-patches" do
    context "when setting defaults" do
      should "should populate `files'" do
        assert_equal %w{Rakefile VERSION.yml bin/foo_the_ultimate_bin lib/foo_the_ultimate_lib.rb }, @spec.files.sort
      end

      should "should populate `executables'" do
        assert_equal %w{ foo_the_ultimate_bin }, @spec.executables
      end

      context "with values already set" do
        setup do
          @spec.files = %w{ hey_include_me_in_gemspec }
          @spec.set_jeweler_defaults(fixture_dir)
        end

        should "not re-populate `files'" do
          assert_equal %w{ hey_include_me_in_gemspec }, @spec.files
        end
      end

      context "for rdoc" do
        should "be enabled" do
          assert @spec.has_rdoc
        end

        should "be utf-8" do
          assert @spec.rdoc_options.include?('--charset=UTF-8')
        end
      end
    end

    should "allow the user to concat files to the existing `files' array" do
      before = @spec.files.dup
      @spec.files << 'extra'

      assert_equal before + %w{ extra }, @spec.files
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
technicalpickles-jeweler-0.11.0 test/test_specification.rb
jeweler-0.11.0 test/test_specification.rb
jeweler-0.11.1 test/test_specification.rb