Sha256: 731393e46e8f93845d623fc3d7bfb2fb1a1e0ad3d10111f7816e0e5dae1431da

Contents?: true

Size: 1003 Bytes

Versions: 2

Compression:

Stored size: 1003 Bytes

Contents

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

class PushCommandTest < CommandTest
  context "pushing" do
    setup do
      @command = Gem::Commands::PushCommand.new
      stub(@command).say
    end

    should "setup and send the gem" do
      mock(@command).setup
      mock(@command).send_gem
      @command.execute
    end

    should "raise an error with no arguments" do
      assert_raise Gem::CommandLineError do
        @command.send_gem
      end
    end

    should "push a gem" do
      mock(@command).say("Pushing gem to Gemcutter...")
      @response = "success"
      FakeWeb.register_uri :post, "https://gemcutter.heroku.com/gems", :body => @response

      @gem = "test"
      @io = "io"
      @config = { :gemcutter_key => "key" }

      stub(File).open(@gem) { @io }
      stub(@io).read.stub!.size

      stub(@command).options { {:args => [@gem]} }
      stub(Gem).configuration { @config }

      mock(@command).say(@response)
      @command.send_gem
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
qrush-gemcutter-0.0.7 test/unit/commands/push_command_test.rb
gemcutter-0.0.7 test/unit/commands/push_command_test.rb