1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
require 'helper'
describe Twitter::Base do
before do
@base = Twitter::Base.new(id: 1)
end
describe '#[]' do
it 'calls methods using [] with symbol' do
capture_warning do
expect(@base[:object_id]).to be_an Integer
end
end
it 'calls methods using [] with string' do
capture_warning do
expect(@base['object_id']).to be_an Integer
end
end
it 'returns nil for missing method' do
capture_warning do
expect(@base[:foo]).to be_nil
expect(@base['foo']).to be_nil
end
end
end
describe '#attrs' do
it 'returns a hash of attributes' do
expect(@base.attrs).to eq(id: 1)
end
end
end
|