Sha256: f758759a3b2aedbb3fac4d6364ebb2238a9b06c192eb4a43c77246d4bdbfa8c6

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

require 'spec_helper'

describe Message do
  describe "#initialize" do
    let(:to) { random_mobile }
    let(:from) { random_mobile }
    let(:body) { random_string }
    let(:message) { Esendex::Message.new(to, body, from) }
    
    it "should have to set" do
      expect(message.to).to eq(to)
    end
    
    it "should have from set" do
      expect(message.from).to eq(from)
    end
    
    it "should have body set" do
      expect(message.body).to eq(body)
    end
  end
  
  describe "#xml_node" do
    let(:to) { random_mobile }
    let(:body) { random_string }
    let(:message) { Esendex::Message.new(to, body) }

    subject { message.xml_node }

    it "contains a to node" do
      expect(subject.at_xpath('//message/to').content).to eq(to)
    end
    it "contains a body node" do
      expect(subject.at_xpath('//message/body').content).to eq(body)
    end

    context "when #from set" do
      let(:from) { random_string }

      before(:each) do
        message.from = from
      end

      it "contains a from node" do
        expect(subject.at_xpath('//message/from').content).to eq(from)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
esendex-0.6.0 spec/message_spec.rb