Sha256: d6045834eecfe9f4053408adb5c7d33541b88d6391e15331b145c608810a57b4

Contents?: true

Size: 1.07 KB

Versions: 2

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
      lambda{ Pump::Xml::Value.new }.should raise_error(ArgumentError)
      lambda{ subject }.should_not 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
        subject.to_s('custom_path').should eql("\#{remove_ilegal_chars custom_path.to_s.encode(:xml => :text)}")
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pump-0.6.6 spec/pump/xml/value_spec.rb
pump-0.6.5 spec/pump/xml/value_spec.rb