Sha256: 17de0d1547c939e8983610883402120a94bfab97711aa66144fb750b377d26bc

Contents?: true

Size: 839 Bytes

Versions: 10

Compression:

Stored size: 839 Bytes

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("\#{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 path name" do
      it do
        subject.to_s('custom_path').should eql("\#{custom_path.to_s.encode(:xml => :text)}")
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
pump-0.6.4 spec/pump/xml/value_spec.rb
pump-0.6.3 spec/pump/xml/value_spec.rb
pump-0.6.2 spec/pump/xml/value_spec.rb
pump-0.6.1 spec/pump/xml/value_spec.rb
pump-0.6.0 spec/pump/xml/value_spec.rb
pump-0.5.1 spec/pump/xml/value_spec.rb
pump-0.5.0 spec/pump/xml/value_spec.rb
pump-0.4.0 spec/pump/xml/value_spec.rb
pump-0.3.0 spec/pump/xml/value_spec.rb
pump-0.2.0 spec/pump/xml/value_spec.rb