spec/client_spec.rb in rumour-ruby-0.0.2 vs spec/client_spec.rb in rumour-ruby-0.0.3

- old
+ new

@@ -20,10 +20,16 @@ it 'falls back to the configuration credentials' do rumour_client = Rumour::Client.new expect(rumour_client.access_token).to eq('CONFIGURED_ACCESS_TOKEN') end + + it 'raises an AuthenticationError if no access_token is supplied' do + Rumour.configure { |config| config.access_token = nil } + expect { rumour_client = Rumour::Client.new }.to raise_error(Rumour::Errors::AuthenticationError) + Rumour.configure { |config| config.access_token = 'CONFIGURED_ACCESS_TOKEN' } + end end describe '.send_text_message with valid data' do it 'creates and retrieves a new message as a hash' do rumour_client = Rumour::Client.new(RUMOUR_TEST_ACCESS_TOKEN) @@ -32,10 +38,10 @@ expect(text_message['id']).to_not be_nil end end describe '.send_text_message with invalid data' do - it 'creates and retrieves a new message as a hash' do + it 'raises a RequestError' do rumour_client = Rumour::Client.new(RUMOUR_TEST_ACCESS_TOKEN) expect { text_message = rumour_client.send_text_message('+351123456789', '+351123456789', 'Hello from rumour-ruby!') }.to raise_error(Rumour::Errors::RequestError)