Sha256: 7494b09ab53acfc4790ea732afd06b32a77edb07b81becd64571f8717e63d3e2

Contents?: true

Size: 1.82 KB

Versions: 22

Compression:

Stored size: 1.82 KB

Contents

require File.dirname(__FILE__) + '/test_helper'

class SpecificationTest < Test::Unit::TestCase
  include SproutTestCase

  context "a newly defined specification" do
    setup do
      @spec = Sprout::Specification.new do |s|
        s.version = '1.0.pre'
      end
    end

    should "have a default name" do
      assert_equal 'specification_test', @spec.name
    end

    should "accept the version" do
      assert_equal '1.0.pre', @spec.version
    end

    context "with a new name" do
      setup do
        @spec.name    = 'foo_sdk'
        @spec.version = '1.0.pre'
      end

      should "register executables" do
        @spec.add_file_target do |t|
          t.add_executable :foo, 'bin/foo'
        end

        Sprout::Executable.stubs :require_ruby_package
        assert_not_nil Sprout::Executable.load :foo, 'foo_sdk', '1.0.pre'
      end

      should "load returns libraries in expected order" do
        @spec.add_file_target do |t|
          t.add_library :swc, 'bin/foo'
          t.add_library :src, 'bin/bar'
        end

        # Without specifying the :swc/:src decision:
        library = Sprout::Library.load nil, 'foo_sdk'
        assert_equal 'foo', File.basename(library.path)
      end

     
    end
  end

  context "a newly included executable" do
    setup do
      @echo_chamber = File.join fixtures, 'executable', 'echochamber_gem', 'echo_chamber'
      $:.unshift File.dirname(@echo_chamber)
    end

    teardown do
      $:.shift
    end

    should "require the sproutspec" do
      path = Sprout::Executable.load(:echos, 'echo_chamber').path
      assert_matches /fixtures\/.*echochamber/, path
      assert_file path

      # TODO: We should be able to execute
      # the provided executable!
      #response = Sprout::System.create.execute path
      #assert_equal 'ECHO ECHO ECHO', response
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
sprout-1.0.26.pre test/unit/specification_test.rb
sprout-1.0.25.pre test/unit/specification_test.rb
sprout-1.0.24.pre test/unit/specification_test.rb
sprout-1.0.23.pre test/unit/specification_test.rb
sprout-1.0.22.pre test/unit/specification_test.rb
sprout-1.0.20.pre test/unit/specification_test.rb
sprout-1.0.19.pre test/unit/specification_test.rb
sprout-1.0.18.pre test/unit/specification_test.rb
sprout-1.0.17.pre test/unit/specification_test.rb
sprout-1.0.16.pre test/unit/specification_test.rb
sprout-1.0.15.pre test/unit/specification_test.rb
sprout-1.0.14.pre test/unit/specification_test.rb
sprout-1.0.13.pre test/unit/specification_test.rb
sprout-1.0.11.pre test/unit/specification_test.rb
sprout-1.0.9.pre test/unit/specification_test.rb
sprout-1.0.8.pre test/unit/specification_test.rb
sprout-1.0.5.pre test/unit/specification_test.rb
sprout-1.0.4.pre test/unit/specification_test.rb
sprout-1.0.3.pre test/unit/specification_test.rb
sprout-1.0.2.pre test/unit/specification_test.rb