Sha256: b79d91ae644e062a7122aba953e30d243c2871477f052b934f09e30c6d1683ef

Contents?: true

Size: 945 Bytes

Versions: 1

Compression:

Stored size: 945 Bytes

Contents

require "spec_helper"

RSpec.describe Burlap::Node do
  describe "#to_burlap" do
    subject(:burlap) { described_class.new(name: "name", value: value).to_burlap }

    context "with a string" do
      let(:value) { "updateUser" }

      it "returns a string" do
        expect(burlap).to be_a_kind_of(String)
      end

      it "puts name in brackets" do
        expect(burlap).to eq("<name>updateUser</name>")
      end
    end

    context "with UTF8 characters" do
      let(:value) { "Håva" }

      it "uses decimal escaping for utf8 characters" do
        expect(burlap).to eq(%{<name>H&#229;va</name>})
      end
    end

    context "with nested XML" do
      let(:value) { "<length>1</length>" }

      it "returns a string" do
        expect(burlap).to be_a_kind_of(String)
      end

      it "does not escape the value containing XML" do
        expect(burlap).to eq("<name><length>1</length></name>")
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
burlap-1.0.0 spec/burlap/node_spec.rb