Sha256: 6cc7ef98c3f674f3bebbb9ad06a83b9f8c1f339d23b3807748e3237b0a56d94b

Contents?: true

Size: 1.37 KB

Versions: 10

Compression:

Stored size: 1.37 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).say("Your gem sources are now:")
      mock(@command).say("- #{@sources.first}")
      mock(@command).say("- #{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

10 entries across 10 versions & 2 rubygems

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