Sha256: 3df16a5ed9ba4010e936b410918b5f7e8c529ecc5d561b200f63d9b9f6a4c659

Contents?: true

Size: 1.54 KB

Versions: 4

Compression:

Stored size: 1.54 KB

Contents

# Generators register themself on the CLI module
require "./lib/roger/release.rb"
require "test/unit"

module Roger
  class ReleaseTest < ::Test::Unit::TestCase

    def setup
      @project = Project.new(File.dirname(__FILE__) + "/../project", :mockupfile_path => false)
      @mockupfile = Roger::Mockupfile.new(@project)
    end


    def test_run_should_set_project_mode
      assert_equal @project.mode, nil

      # Running a blank release
      @mockupfile.release(:blank => true) do |r|
        r.use Proc.new{|release|
          assert_equal release.project.mode, :release
        }
      end

      @project.release.run!
      assert_equal @project.mode, nil
    end

    def test_blank_release_should_have_no_processors_and_finalizers
      @mockupfile.release(:blank => true)
      @project.release.run!

      assert @project.release.stack.empty?
      assert @project.release.finalizers.empty?
    end

    def test_get_callable
      p = lambda{}
      assert_equal Release.get_callable(p, {}), p
      assert_raise(ArgumentError){ Release.get_callable(nil, {})}
    end

    def test_get_callable_with_map
      p = lambda{}
      map = {
        :lambda => p,
      }

      assert_equal Release.get_callable(:lambda, map), p
      assert_raise(ArgumentError){ Release.get_callable(:huh, map)}
    end

    class Works
      def call; end
    end
    class Breaks
    end

    def test_get_callable_with_class
      assert Release.get_callable(Works, {}).instance_of?(Works)
      assert_raise(ArgumentError){ Release.get_callable(Breaks, {}) }
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
roger-1.1.3 test/unit/release_test.rb
roger-1.1.2 test/unit/release_test.rb
roger-1.1.1 test/unit/release_test.rb
roger-1.1.0 test/unit/release_test.rb