Class UnifiedMatchers::TestGnuDiffMatcher
In: lib/unified_matchers/gnu_diff_matcher.rb
Parent: ::Test::Unit::TestCase

Methods

setup   teardown   test_diff  

Included Modules

UnifiedMatchers::Assertions OCmd::Runners::Mockable

Public Instance methods

[Source]

# File lib/unified_matchers/gnu_diff_matcher.rb, line 57
      def setup
        @old_runner = GnuDiffMatcher.runner
        @mock_runner = GnuDiffMatcher.runner =
          OCmd::Runners::System.new.make_mock {}
        self.matcher = GnuDiffMatcher.new
        @my = UnifiedMatchers.fixtures/'my.file'
      end

[Source]

# File lib/unified_matchers/gnu_diff_matcher.rb, line 65
      def teardown
        GnuDiffMatcher.runner = @old_runner
      end

[Source]

# File lib/unified_matchers/gnu_diff_matcher.rb, line 69
      def test_diff
        assert_success "foo/bar\n", @my
        assert_success "I'm not equal to @my.to_s", @my.to_s
        assert_success(/foo/, @my)
        assert_success @my.open, @my

        re = /diff .* .* -u --label ref --label my/
        @mock_runner.log.each do |cmd|
          assert_match re, cmd.to_sh
        end
        assert_match @my.to_s, @mock_runner.log.first.to_sh
        assert_equal 3, @mock_runner.log.size
      end

[Validate]