Sha256: d2754690e36c6718400e806d7ee4c822d3f3e14c2c67b41949541ad661942b0b

Contents?: true

Size: 821 Bytes

Versions: 3

Compression:

Stored size: 821 Bytes

Contents

require 'spec_helper'

describe Trackerific::Builders::Base::XML do
  let(:builder) { described_class.new(:hello, :world) }

  subject { builder }

  it { should respond_to :xml_version }
  it { should respond_to :xml_version= }

  context "when #build is not implemented in the subclass" do
    it "should raise a NotImplementedError on initialize" do
      expect {
        builder.new
      }.to raise_error NotImplementedError
    end
  end

  context "when #build is implemented in the subclass" do
    subject { builder.new('hi', 'earth') }

    before do
      builder.send(:define_method, :build) do
        builder.Hello hello
        builder.World world
      end
    end

    let(:xml) do
      '<?xml encoding="UTF-8"?><Hello>hi</Hello><World>earth</World>'
    end

    its(:xml) { should eq xml }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
trackerific-0.7.4 spec/lib/trackerific/builders/base/xml_spec.rb
trackerific-0.7.3 spec/lib/trackerific/builders/base/xml_spec.rb
trackerific-0.7.2 spec/lib/trackerific/builders/base/xml_spec.rb