Sha256: b7091c3cf7b4c7428e711f0b8a5d300dc9e023e00e2469279426e513fa677a08

Contents?: true

Size: 1000 Bytes

Versions: 10

Compression:

Stored size: 1000 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

10 entries across 10 versions & 2 rubygems

Version Path
qrush-gemcutter-0.0.8 test/commands/push_command_test.rb
qrush-gemcutter-0.0.9 test/commands/push_command_test.rb
qrush-gemcutter-0.1.0 test/commands/push_command_test.rb
qrush-gemcutter-0.1.1 test/commands/push_command_test.rb
qrush-gemcutter-0.1.2 test/commands/push_command_test.rb
gemcutter-0.1.2 test/commands/push_command_test.rb
gemcutter-0.1.1 test/commands/push_command_test.rb
gemcutter-0.1.0 test/commands/push_command_test.rb
gemcutter-0.0.9 test/commands/push_command_test.rb
gemcutter-0.0.8 test/commands/push_command_test.rb