Sha256: b7b614aac44f1289a83b9a87d6bf1d8a9132f0f59f125c3bbbfcf510904dba67

Contents?: true

Size: 1.07 KB

Versions: 6

Compression:

Stored size: 1.07 KB

Contents

require 'spec_helper'

describe Pump::Xml::Value do
  subject { Pump::Xml::Value.new("method_name") }

  describe ".new" do
    it "requires one parameter" do
      expect{ Pump::Xml::Value.new }.to raise_error(ArgumentError)
      expect{ subject }.not_to raise_error
    end
  end

  describe "#plain" do
    its(:plain) { should eql("object.method_name") }
  end

  describe "#to_s" do
    its(:to_s) { should eql("\#{remove_ilegal_chars object.method_name.to_s.encode(:xml => :text)}") }

    context "with option :xmlsafe => true" do
      subject { Pump::Xml::Value.new("method_name", {}, [], :xmlsafe => true) }

      its(:to_s) { should eql("\#{object.method_name}") }
    end

    context "with option :typecast => :xmlschema" do
      subject { Pump::Xml::Value.new("method_name", {}, [], :typecast => :xmlschema) }

      its(:to_s) { should eql("\#{object.method_name.xmlschema}") }
    end

    context "with path name" do
      it do
        expect(subject.to_s('custom_path')).to eql("\#{remove_ilegal_chars custom_path.to_s.encode(:xml => :text)}")
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pump-0.11.0 spec/pump/xml/value_spec.rb
pump-0.10.0 spec/pump/xml/value_spec.rb
pump-0.9.1 spec/pump/xml/value_spec.rb
pump-0.9.0 spec/pump/xml/value_spec.rb
pump-0.8.0 spec/pump/xml/value_spec.rb
pump-0.7.0 spec/pump/xml/value_spec.rb