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-3.3.4 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb
rhodes-3.3.3 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb
rhodes-3.3.3.beta.4 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb
rhodes-3.3.3.beta.3 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb
rhodes-3.3.3.beta.2 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb
rhodes-3.3.3.beta.1 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb
rhodes-3.3.2 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb
rhodes-3.3.2.beta.7 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb
rhodes-3.3.2.beta.6 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb
rhodes-3.3.2.beta.5 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb
rhodes-3.3.2.beta.4 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb
rhodes-3.3.2.beta.3 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb
rhodes-3.3.2.beta.2 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb
rhodes-3.3.2.beta.1 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb
rhodes-3.3.1 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb
rhodes-3.3.0 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb
rhodes-3.3.0.beta.3 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb
rhodes-3.3.0.beta.2 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb
rhodes-3.3.0.beta.1 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb
rhodes-3.2.3 spec/framework_spec/app/spec/core/encoding/converter/finish_spec.rb