Sha256: c6b475067823162c278378f3e8fc9226b4935cfeaf8e9df92811923613b02272

Contents?: true

Size: 983 Bytes

Versions: 1

Compression:

Stored size: 983 Bytes

Contents

require File.dirname(__FILE__) + '/test_helper'

# ENV['VERBOSE'] = 'true'

class BadEncodingsTest < Test::Unit::TestCase
  context 'A file with bad encodings' do
    should 'fail' do
      path = File.dirname(__FILE__)
      bad_file = path + '/bad_encodings/bad1.rb'
      bad_lines = BadEncodings.find_lines_in_file(bad_file)
      assert_equal bad_lines, [[path+"/bad_encodings/bad1.rb", 4]]
    end
  end

  context 'A path with bad encodings' do
    should 'fail' do
      path = File.dirname(__FILE__)
      bad_lines = BadEncodings.find_lines_in_path(path)
      assert_equal bad_lines, [[path+"/bad_encodings/bad1.rb", 4], [path+"/bad_encodings/bad2.rb", 1], [path+"/bad_encodings/bad2.rb", 3], [path+"/bad_encodings/bad3.rb", 1]]
    end

    should 'fail with certain file extensions' do
      path = File.dirname(__FILE__)
      bad_lines = BadEncodings.find_lines_in_path(path, ['yml'])
      assert_equal bad_lines, [[path+"/bad_encodings/ok.yml", 4]]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bad_encodings-ruby19-1.0.0 test/bad_encodings_test.rb