Sha256: 71566c9e43b3d80d74dbb84d7b42826700c91335daecad4e6e3000b8f8f67703

Contents?: true

Size: 746 Bytes

Versions: 2

Compression:

Stored size: 746 Bytes

Contents

require 'spec_helper'

describe Zenvia::Sms do
  describe "#send" do
    let(:request_mock) { double post: true }

    subject { described_class.new :number, :message }

    before do
      Zenvia::Request.stub(:new).and_return request_mock
    end

    it "should call request with correct params" do
      request_mock.should_receive(:post).with({
        to: :number, message: :message, dispatch: :send
      })

      subject.send
    end

    context "when there is a message id" do
      it "should send id" do
        request_mock.should_receive(:post).with({
          to: :number, message: :message, dispatch: :send, id: 'message id'
        })

        subject.message_id = 'message id'
        subject.send
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
zenvia-0.0.2 spec/zenvia/sms_spec.rb
zenvia-0.0.1 spec/zenvia/sms_spec.rb