Sha256: 6f013a04f12772bcce7af3577dab707984b67d50fea9fb5cdc4fe30c40f7926a

Contents?: true

Size: 1.5 KB

Versions: 3

Compression:

Stored size: 1.5 KB

Contents

require 'test_helper'

class Jeweler
  module Commands
    class TestBuildGem < Test::Unit::TestCase

      context "after running" do
        setup do
          @gemspec = Object.new
          stub(@gemspec).file_name { 'zomg-1.2.3.gem' }

          @gemspec_helper = Object.new
          stub(@gemspec_helper).parse { @gemspec }

          @builder = Object.new
          stub(Gem::Builder).new { @builder }
          stub(@builder).build { 'zomg-1.2.3.gem' }

          @file_utils = Object.new
          stub(@file_utils).mkdir_p './pkg'
          stub(@file_utils).mv './zomg-1.2.3.gem', './pkg'

          @base_dir = '.'

          @command = Jeweler::Commands::BuildGem.new
          @command.base_dir = @base_dir
          @command.file_utils = @file_utils
          @command.gemspec_helper = @gemspec_helper

          @command.run
        end

        should "call gemspec helper's parse" do
          assert_received(@gemspec_helper) {|gemspec_helper| gemspec_helper.parse }
        end

        should "build from parsed gemspec" do
          assert_received(Gem::Builder) {|builder_class| builder_class.new(@gemspec) }
          assert_received(@builder) {|builder| builder.build }
        end

        should 'make package directory' do
          assert_received(@file_utils) {|file_utils| file_utils.mkdir_p './pkg'}
        end

        should 'move built gem into package directory' do
          assert_received(@file_utils) {|file_utils| file_utils.mv './zomg-1.2.3.gem', './pkg'}
        end
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
dima-jeweler-0.9.2 test/jeweler/commands/test_build_gem.rb
technicalpickles-jeweler-0.9.0 test/jeweler/commands/test_build_gem.rb
technicalpickles-jeweler-0.9.1 test/jeweler/commands/test_build_gem.rb