Skip to content

Unexpected namespace prefix 'default' on SSML documents #24

Description

@Jared-Prime

I noticed running unit tests in our application that ssml nodes were getting a 'default' prefix after being embedded in a parent element. This occurred under Ruby 1.9.3-p484 but not under JRuby 1.7.4.

Sample test:

      context 'embedding nodes' do
        let(:fallback_doc){fallback_ssml(prompt, 'howdy.wav')}
        specify 'embeds fallback correctly' do
          subject.set_main_prompt(prompt, 'howdy.wav')
          subject.announcer_prompt.first.to_s.should eq fallback_doc.to_s
        end
      end

Sample test output running 1.9.3-p484:

Failures:

  1) Ifbyphone::Announcer protected methods #set_main_prompt embedding nodes embeds fallback correctly
     Failure/Error: subject.announcer_prompt.first.to_s.should eq fallback_doc.to_s

       expected: "<speak xmlns=\"http://www.w3.org/2001/10/synthesis\" version=\"1.0\" xml:lang=\"en-US\">\n  <audio src=\"howdy.wav\">\n    <voice name=\"Paul\">\n      <prosody rate=\"1.0\">Riddle me this!</prosody>\n    </voice>\n  </audio>\n</speak>"
            got: "<speak xmlns=\"http://www.w3.org/2001/10/synthesis\" version=\"1.0\" xml:lang=\"en-US\">\n  <audio src=\"howdy.wav\">\n    <default:voice name=\"Paul\">\n      <prosody rate=\"1.0\">Riddle me this!</prosody>\n    </default:voice>\n  </audio>\n</speak>"

       (compared using ==)

       Diff:

       @@ -1,8 +1,8 @@
        <speak xmlns="http://www.w3.org/2001/10/synthesis" version="1.0" xml:lang="en-US">
          <audio src="howdy.wav">
       -    <voice name="Paul">
       +    <default:voice name="Paul">
              <prosody rate="1.0">Riddle me this!</prosody>
       -    </voice>
       +    </default:voice>
          </audio>
        </speak>
     # ./spec/ifbyphone/announcer_spec.rb:346:in `block (5 levels) in <top (required)>'

You've Nyaned for 1.91 seconds

1 example, 1 failure

JRuby passes happily.

I wonder, but do not know, if this conditional treatment of Nokogiri implementation of JRuby contributes to this phenomenon. While this is not a huge issue for us since we're running JRuby in production, it caused some concern that the tests behave differently under different rubies. I am also concerned for anybody out there using MRI.

Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions