Sha256: 12cbb6bd4cc262aeb3fec438a7b6624ee1030d1f49461e99e40b2ced61e772af

Contents?: true

Size: 706 Bytes

Versions: 1

Compression:

Stored size: 706 Bytes

Contents

require 'txt_file_mutator'
require "test/unit"

class TestTxtFileMutator < Test::Unit::TestCase

  def setup
    @tfm = TextFileMutator
    @file = 'DATA_REMOVE.txt'
    puts @tfm.instance_methods
  end

  def teardown
    ## Nothing really
  end

  def has_content?(file, content)
    content = File.read(file)
    res = content =~ /#{content}/
    !res.nil?
  end

  def test_insert_before
    content = 'BEFORE'
    @tfm.insert_before @file, 'before', content
    @tfm.insert_before @file, 'before', content

    assert_equal false, @tfm.has_multiple_content_before?(File.read(@file), content, 'before'), "Same content inserted should not be repeated after multiple insert before"            
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
txt_file_mutator-0.2.2 test/test_insert_before_and_after.rb