Sha256: f4851d285101a55405717d7184c70a8a1eaa43332da3dc414624ae79100f1016

Contents?: true

Size: 874 Bytes

Versions: 23

Compression:

Stored size: 874 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

describe 'string_encoder' do
  before do
    @object = Object.new
    @object.extend(OhlohScm::System)
    def @object.string_encoder
      string_encoder_path
    end
  end

  it 'preserve length of translated content' do
    file_path = FIXTURES_DIR + '/sample-content'
    original_content_length = File.size(file_path)
    original_content_lines = File.readlines(file_path).size

    output = `cat #{ file_path } | #{ @object.string_encoder }`

    assert_equal original_content_length, output.length
    assert_equal original_content_lines, output.split("\n").length
  end

  it 'must convert invalid characters' do
    invalid_utf8_word_path = FIXTURES_DIR + '/invalid-utf-word'

    string = `cat #{ invalid_utf8_word_path } | #{ @object.string_encoder }`

    assert_equal true, string.valid_encoding?
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
ohloh_scm-4.0.4 spec/string_encoder_spec.rb
ohloh_scm-4.0.3 spec/string_encoder_spec.rb
ohloh_scm-4.0.2 spec/string_encoder_spec.rb
ohloh_scm-4.0.1 spec/string_encoder_spec.rb
ohloh_scm-3.0.21 spec/string_encoder_spec.rb
ohloh_scm-3.0.19 spec/string_encoder_spec.rb
ohloh_scm-3.0.17 spec/string_encoder_spec.rb
ohloh_scm-3.0.16 spec/string_encoder_spec.rb
ohloh_scm-3.0.15 spec/string_encoder_spec.rb
ohloh_scm-3.0.14 spec/string_encoder_spec.rb
ohloh_scm-3.0.13 spec/string_encoder_spec.rb
ohloh_scm-3.0.12 spec/string_encoder_spec.rb
ohloh_scm-3.0.11 spec/string_encoder_spec.rb
ohloh_scm-3.0.10 spec/string_encoder_spec.rb
ohloh_scm-3.0.9 spec/string_encoder_spec.rb
ohloh_scm-3.0.8 spec/string_encoder_spec.rb
ohloh_scm-3.0.7 spec/string_encoder_spec.rb
ohloh_scm-3.0.6 spec/string_encoder_spec.rb
ohloh_scm-3.0.5 spec/string_encoder_spec.rb
ohloh_scm-3.0.4 spec/string_encoder_spec.rb