Sha256: a1b0fe10a0ef5f6a5a449f2cf22bc7b1f50a05a766b7e79e2f6aecddddacee76

Contents?: true

Size: 1.06 KB

Versions: 3

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'

describe "Reducers" do
  describe :join_xml do
    include_context "reducers"
    it_behaves_like 'a processor', :named => :join_xml

    it "joins XML spread out over multiple lines" do
      processor(:join_xml).given('<xml>first line', 'second line', 'third line</xml>').should emit("<xml>first line\nsecond line\nthird line</xml>")
    end
    
    it "joins XML one-per-line" do
      processor(:join_xml).given('<xml>first line</xml>', '<xml>second line</xml>', '<xml>third line</xml>').should emit('<xml>first line</xml>', '<xml>second line</xml>', '<xml>third line</xml>')
    end

    it "joins XML split in the middle of a line" do
      processor(:join_xml).given('<xml>first line', 'second</xml><xml> line', 'third line</xml>').should emit("<xml>first line\nsecond</xml>", "<xml> line\nthird line</xml>")
    end

    it "joins XML with a custom tag" do
      processor(:join_xml, root: 'foobar').given('<foobar>first line', 'second line', 'third line</foobar>').should emit("<foobar>first line\nsecond line\nthird line</foobar>")
    end
    
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
ul-wukong-4.1.1 spec/wukong/widget/reducers/join_xml_spec.rb
ul-wukong-4.1.0 spec/wukong/widget/reducers/join_xml_spec.rb
wukong-4.0.0 spec/wukong/widget/reducers/join_xml_spec.rb