Sha256: 8111700eb2dd6d47394c0efc96d5f918fae8a2d89fe6d22004f0a7a703d86668

Contents?: true

Size: 1.38 KB

Versions: 2

Compression:

Stored size: 1.38 KB

Contents

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

class TumbleCommandTest < CommandTest
  context "with a tumbler and some sources" do
    setup do
      @sources = ["gems.rubyforge.org", URL]
      stub(Gem).sources { @sources }
      @command = Gem::Commands::TumbleCommand.new
    end

    should "show sources" do
      mock(@command).puts("Your gem sources are now:")
      mock(@command).puts("- #{@sources.first}")
      mock(@command).puts("- #{URL}")
      @command.show_sources
    end
  end

  context "tumbling the gem sources" do
    setup do
      @sources = ["http://rubyforge.org"]
      stub(Gem).sources { @sources }
      @config = Object.new
      stub(Gem).configuration { @config }

      @command = Gem::Commands::TumbleCommand.new
    end

    should "add gemcutter as first source" do
      mock(@sources).unshift(URL)
      mock(@config).write

      @command.tumble
    end

    should "remove gemcutter if it's in the sources" do
      mock(@sources).include?(URL) { true }
      mock(@config).write
      mock(@sources).delete(URL)

      @command.tumble
    end
  end

  context "executing the tumbler" do
    setup do
      @command = Gem::Commands::TumbleCommand.new
    end

    should "say thanks, tumble and show the sources" do
      mock(@command).say(anything)
      mock(@command).tumble
      mock(@command).show_sources

      @command.execute
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

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