Skip to content

Commit c73de83

Browse files
committed
#2508 fix CI with postgres
1 parent c860b2f commit c73de83

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

spec/rails_admin/support/csv_converter_spec.rb

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,20 @@
4545
end
4646
end
4747

48-
context 'when encoding FROM MySQL latin1' do
49-
let(:encoding) { '' }
50-
let(:objects) { FactoryGirl.create_list :player, 1, number: 1, name: 'Josè'.encode('ISO-8859-1') }
51-
52-
it 'exports to ISO-8859-1', active_record: true do
53-
expect(::ActiveRecord::Base.connection).to receive(:encoding) { 'latin1' }
54-
expect(subject[1]).to eq 'ISO-8859-1'
55-
expect(subject[2].encoding).to eq Encoding::ISO_8859_1
56-
expect(subject[2].unpack('H*').first).
57-
to eq '4e756d6265722c4e616d650a312c4a6f73e80a'
48+
49+
# postgresql cannot load invalid data: invalid byte sequence for encoding "UTF8": 0xe8
50+
unless ActiveRecord::Base.connection_config[:adapter] == 'postgresql'
51+
context 'when encoding FROM MySQL latin1' do
52+
let(:encoding) { '' }
53+
let(:objects) { FactoryGirl.create_list :player, 1, number: 1, name: 'Josè'.encode('ISO-8859-1') }
54+
55+
it 'exports to ISO-8859-1', active_record: true do
56+
expect(::ActiveRecord::Base.connection).to receive(:encoding) { 'latin1' }
57+
expect(subject[1]).to eq 'ISO-8859-1'
58+
expect(subject[2].encoding).to eq Encoding::ISO_8859_1
59+
expect(subject[2].unpack('H*').first).
60+
to eq '4e756d6265722c4e616d650a312c4a6f73e80a'
61+
end
5862
end
5963
end
6064

0 commit comments

Comments
 (0)