Sha256: 524d805c2dbe97035b1d88b7073f38606a68bab8532e507cb08692dc0a5d22c2

Contents?: true

Size: 1.16 KB

Versions: 5

Compression:

Stored size: 1.16 KB

Contents

# encoding: utf-8
require 'git_topic'


# Disable caching on GitTopic for specs since we're calling the methods directly
# rather than assuming atmoic invocations.
class << GitTopic
  %w( current_branch remote_branches remote_branches_organized branches
      ).each do |m|

    define_method( "#{m}_with_nocache" ) do
      rv = send( "#{m}_without_nocache" )
      GitTopic::Naming::ClassMethods.class_variable_set( "@@#{m}", nil )
      rv
    end
    alias_method_chain m.to_sym, :nocache
  end

  def git_with_implicit_capture( cmds=[], opts={} )
    if opts[:show]
      puts capture_git( cmds )
    else
      git_without_implicit_capture( cmds, opts )
    end
  end
  alias_method_chain  :git, :implicit_capture
end


# Track original $stdout, $stderr write methods so we can “unmock” them for
# debugging

class << $stdout
  alias_method :real_write, :write
end
class << $stderr
  alias_method :real_write, :write
end


class Object
  def debug
    # For debugging, restore stubbed write
    class << $stdout
      alias_method :write, :real_write
    end
    class << $stderr
      alias_method :write, :real_write
    end

    require 'ruby-debug'
    debugger
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
git-topic-0.1.6.4 spec/spec_helper.rb
git-topic-0.1.6.3 spec/spec_helper.rb
git-topic-0.1.6.2 spec/spec_helper.rb
git-topic-0.1.5 spec/spec_helper.rb
git-topic-0.1.4 spec/spec_helper.rb