Sha256: e89fe753ad9e4b04166a40a21c349dc16c5b3118c4a53c310eb73d467b6b9c4c

Contents?: true

Size: 1.09 KB

Versions: 5

Compression:

Stored size: 1.09 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
      message.to.should eq(to)
    end
    
    it "should have from set" do
      message.from.should eq(from)
    end
    
    it "should have body set" do
      message.body.should 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
      subject.at_xpath('//message/to').content.should eq(to)
    end
    it "contains a body node" do
      subject.at_xpath('//message/body').content.should 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
        subject.at_xpath('//message/from').content.should eq(from)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
esendex-0.3.2 spec/message_spec.rb
esendex-0.3.1 spec/message_spec.rb
esendex-0.3.0 spec/message_spec.rb
esendex-0.2.3 spec/message_spec.rb
esendex-0.2.2 spec/message_spec.rb