summaryrefslogtreecommitdiff
path: root/spec/ruby/core/encoding/invalid_byte_sequence_error/destination_encoding_spec.rb
blob: c2ed6de1d854d85422f0bdf0b8e86186af835747 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
require_relative "../../../spec_helper"
require_relative '../fixtures/classes'

describe "Encoding::InvalidByteSequenceError#destination_encoding" do
  before :each do
    @exception, = EncodingSpecs::InvalidByteSequenceError.exception
    @exception2, = EncodingSpecs::InvalidByteSequenceErrorIndirect.exception
  end

  it "returns an Encoding object" do
    @exception.destination_encoding.should be_an_instance_of(Encoding)
    @exception2.destination_encoding.should be_an_instance_of(Encoding)
  end

  it "is equal to the destination encoding of the object that raised it" do
    @exception.destination_encoding.should == Encoding::ISO_8859_1
    @exception2.destination_encoding.should == Encoding::UTF_8
  end
end