Sha256: e3ecff7a88439f0da9c1a89ef6526bcbbb01a76939b3021fdc89385a78f1e197

Contents?: true

Size: 1.09 KB

Versions: 52

Compression:

Stored size: 1.09 KB

Contents

require File.expand_path('../../../../spec_helper', __FILE__)

with_feature :encoding do
  describe "Encoding::Converter#finish" do
    before(:each) do
      @ec = Encoding::Converter.new("utf-8", "iso-2022-jp")
    end

    it "returns a String" do
      @ec.convert('foo')
      @ec.finish.should be_an_instance_of(String)
    end

    it "returns an empty String if there is nothing more to convert" do
      @ec.convert("glark")
      @ec.finish.should == ""
    end

    it "returns the last part of the converted String if it hasn't already" do
       @ec.convert("\u{9999}").should == "\e$B9a".force_encoding('iso-2022-jp')
       @ec.finish.should == "\e(B".force_encoding('iso-2022-jp')
    end

    it "returns a String in the destination encoding" do
      @ec.convert("glark")
      @ec.finish.encoding.should == Encoding::ISO2022_JP
    end

    it "returns an empty String if self was not given anything to convert" do
      @ec.finish.should == ""
    end

    it "returns an empty String on subsequent invocations" do
      @ec.finish.should == ""
      @ec.finish.should == ""
    end
  end
end

Version data entries

52 entries across 52 versions & 2 rubygems

Version Path
rhodes-7.6.0 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb
rhodes-7.5.1 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb
rhodes-7.4.1 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb
rhodes-7.1.17 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb
rhodes-6.2.0 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb
rhodes-6.0.11 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb
rhodes-5.5.18 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb
rhodes-5.5.17 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb
rhodes-5.5.15 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb
rhodes-5.5.0.22 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb
rhodes-5.5.2 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb
rhodes-5.5.0.7 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb
rhodes-5.5.0.3 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb
rhodes-5.5.0 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb
tauplatform-1.0.3 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb
tauplatform-1.0.2 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb
tauplatform-1.0.1 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb
rhodes-3.5.1.12 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb
rhodes-3.3.5 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb
rhodes-3.4.2 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb