Sha256: f09bd4e3b1e31e2e0f758667181005117df1fa3e24626fde6f841dd4a31c2057

Contents?: true

Size: 851 Bytes

Versions: 6

Compression:

Stored size: 851 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 :skip_encoding => true" do
      subject { Pump::Xml::Value.new("method_name", {}, [], :skip_encoding => 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

6 entries across 6 versions & 1 rubygems

Version Path
pump-0.1.0 spec/pump/xml/value_spec.rb
pump-0.0.5 spec/pump/xml/value_spec.rb
pump-0.0.4 spec/pump/xml/value_spec.rb
pump-0.0.3 spec/pump/xml/value_spec.rb
pump-0.0.2 spec/pump/xml/value_spec.rb
pump-0.0.1 spec/pump/xml/value_spec.rb