Sha256: 20b26bfaa90f8738a8069d6f3e5ef98e04a227cacc840a1c1cbc91d87ebb5a8f

Contents?: true

Size: 862 Bytes

Versions: 16

Compression:

Stored size: 862 Bytes

Contents

module PuppetTest::FileParsing
    # Run an isomorphism test on our parsing process.
    def fakedataparse(*files)
        files.each do |file|
            @provider.stubs(:default_target).returns(file)

            @provider.prefetch

            text = @provider.to_file(@provider.target_records(file))
            text.gsub!(/^# HEADER.+\n/, '')

            yield if block_given?

            oldlines = File.readlines(file)
            newlines = text.chomp.split "\n"
            oldlines.zip(newlines).each do |old, new|
                if self.is_a?(Test::Unit::TestCase)
                    assert_equal(old.chomp.gsub(/\s+/, ''), new.gsub(/\s+/, ''), "File was not written back out correctly")
                else
                    new.gsub(/\s+/, '').should == old.chomp.gsub(/\s+/, '')
                end
            end
        end
    end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
puppet-0.25.5 test/lib/puppettest/fileparsing.rb
puppet-0.25.4 test/lib/puppettest/fileparsing.rb
puppet-0.25.3 test/lib/puppettest/fileparsing.rb
puppet-0.24.9 test/lib/puppettest/fileparsing.rb
puppet-0.25.2 test/lib/puppettest/fileparsing.rb
puppet-0.25.1 test/lib/puppettest/fileparsing.rb
puppet-0.25.0 test/lib/puppettest/fileparsing.rb
puppet-0.24.0 test/lib/puppettest/fileparsing.rb
puppet-0.24.1 test/lib/puppettest/fileparsing.rb
puppet-0.24.4 test/lib/puppettest/fileparsing.rb
puppet-0.24.3 test/lib/puppettest/fileparsing.rb
puppet-0.24.2 test/lib/puppettest/fileparsing.rb
puppet-0.24.7 test/lib/puppettest/fileparsing.rb
puppet-0.24.5 test/lib/puppettest/fileparsing.rb
puppet-0.24.6 test/lib/puppettest/fileparsing.rb
puppet-0.24.8 test/lib/puppettest/fileparsing.rb