Sha256: 417c682a2cc3ccb4279bec242d6d552335dc82ad4aa59861571e242b78e50e77

Contents?: true

Size: 791 Bytes

Versions: 5

Compression:

Stored size: 791 Bytes

Contents

require 'spec_helper'

describe TMS::VoiceMessages do
  context "creating a new messages list" do
    let(:client) do
      double('client')
    end
    before do
      @messages = TMS::VoiceMessages.new(client, '/messages')
    end
    it 'should GET itself' do
      body = [{:short_body => 'hi ho', :created_at => 'a while ago'}, {:short_body => 'feel me flow', :created_at => 'longer ago'}]
      @messages.client.should_receive(:get).and_return(double('response', :body => body, :status => 200, :headers => {'link' => "</messages/page/2>; rel=\"next\",</messages/page/11>; rel=\"last\""}))

      @messages.get
      @messages.collection.length.should == 2
      @messages.next.href.should == '/messages/page/2'
      @messages.last.href.should == '/messages/page/11'
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tms_client-0.6.0 spec/voice_messages_spec.rb
tms_client-0.5.4 spec/voice_messages_spec.rb
tms_client-0.5.3 spec/voice_messages_spec.rb
tms_client-0.5.2 spec/voice_messages_spec.rb
tms_client-0.5.1 spec/voice_messages_spec.rb