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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
require 'helper'
describe Twitter::REST::Help do
before do
@client = Twitter::REST::Client.new(consumer_key: 'CK', consumer_secret: 'CS', access_token: 'AT', access_token_secret: 'AS')
end
describe '#configuration' do
before do
stub_get('/1.1/help/configuration.json').to_return(body: fixture('configuration.json'), headers: {content_type: 'application/json; charset=utf-8'})
end
it 'requests the correct resource' do
@client.configuration
expect(a_get('/1.1/help/configuration.json')).to have_been_made
end
it 'returns the Twitter configuration' do
configuration = @client.configuration
expect(configuration).to be_a Twitter::Configuration
expect(configuration.characters_reserved_per_media).to eq(20)
end
end
describe '#languages' do
before do
stub_get('/1.1/help/languages.json').to_return(body: fixture('languages.json'), headers: {content_type: 'application/json; charset=utf-8'})
end
it 'requests the correct resource' do
@client.languages
expect(a_get('/1.1/help/languages.json')).to have_been_made
end
it 'returns the list of languages supported by Twitter' do
languages = @client.languages
expect(languages).to be_an Array
expect(languages.first).to be_a Twitter::Language
expect(languages.first.name).to eq('Portuguese')
end
end
describe '#privacy' do
before do
stub_get('/1.1/help/privacy.json').to_return(body: fixture('privacy.json'), headers: {content_type: 'application/json; charset=utf-8'})
end
it 'requests the correct resource' do
@client.privacy
expect(a_get('/1.1/help/privacy.json')).to have_been_made
end
it 'returns the Twitter Privacy Policy' do
privacy = @client.privacy
expect(privacy.split.first).to eq('Twitter')
end
end
describe '#tos' do
before do
stub_get('/1.1/help/tos.json').to_return(body: fixture('tos.json'), headers: {content_type: 'application/json; charset=utf-8'})
end
it 'requests the correct resource' do
@client.tos
expect(a_get('/1.1/help/tos.json')).to have_been_made
end
it 'returns the Twitter Terms of Service' do
tos = @client.tos
expect(tos.split.first).to eq('Terms')
end
end
end
|