Forces UTF-8 encoding when enumerating usernames - Fixes #801

This commit is contained in:
erwanlr
2015-04-11 12:26:15 +01:00
parent 4fbc535b0c
commit a4bbf41086
3 changed files with 25 additions and 3 deletions

View File

@@ -2,7 +2,7 @@
shared_examples 'WpUser::Existable' do
let(:mod) { WpUser::Existable }
let(:fixtures_dir) { MODELS_FIXTURES + '/wp_user/existable' }
let(:fixtures_dir) { File.join(MODELS_FIXTURES, 'wp_user', 'existable') }
describe '::login_from_author_pattern' do
after do
@@ -145,7 +145,7 @@ shared_examples 'WpUser::Existable' do
end
context 'with a 200' do
let(:resp_opt) { { code: 200, body: File.new(fixtures_dir + '/admin.html').read } }
let(:resp_opt) { { code: 200, body: File.read(File.join(fixtures_dir, 'admin.html')) } }
it 'loads the correct values' do
@login = 'admin'
@@ -153,6 +153,15 @@ shared_examples 'WpUser::Existable' do
end
end
context 'when chinese chars' do
let(:resp_opt) { { code: 200, body: File.read(File.join(fixtures_dir, 'chinese_chars.html')) } }
it 'loads the correct values' do
@login = '一路疯下去'
@display_name = nil
end
end
context 'otherwise' do
it 'does not do anything' do
@resp_opt = { code: 404 }