WpUser additional specs
This commit is contained in:
@@ -33,6 +33,34 @@ describe WpUser do
|
||||
end
|
||||
end
|
||||
|
||||
describe '#to_s' do
|
||||
after do
|
||||
subject.id = 1
|
||||
subject.to_s.should == @expected
|
||||
end
|
||||
|
||||
it 'returns @id' do
|
||||
@expected = '1'
|
||||
end
|
||||
|
||||
context 'when @login' do
|
||||
it 'returns @id | @login' do
|
||||
subject.login = 'admin'
|
||||
|
||||
@expected = '1 | admin'
|
||||
end
|
||||
|
||||
context 'when @display_name' do
|
||||
it 'returns @id | @login | @display_name' do
|
||||
subject.login = 'admin'
|
||||
subject.display_name = 'real name'
|
||||
|
||||
@expected = '1 | admin | real name'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#<=>' do
|
||||
it 'bases the comparaison on the :id' do
|
||||
wp_user.id = 1
|
||||
|
||||
@@ -69,6 +69,13 @@ shared_examples 'WpUser::Existable' do
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the body is an ASCII-8BIT' do
|
||||
it 'return the correct display_name' do
|
||||
@body = '<title>its me | wordpress</title>'.encode('ASCII-8BIT')
|
||||
@expected = 'its me'
|
||||
end
|
||||
end
|
||||
|
||||
context 'when pattern is found' do
|
||||
context 'when unencoded extra chars' do
|
||||
it 'returns the display_name w/o extra chars' do
|
||||
@@ -91,7 +98,7 @@ shared_examples 'WpUser::Existable' do
|
||||
end
|
||||
end
|
||||
|
||||
it 'decodes entities in display_name' do
|
||||
it 'decodes entities' do
|
||||
@body = '<title>user & nickname | Wordpress-3.5.1</title>'
|
||||
@expected = 'user & nickname'
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user