Sha256: 7f682b88f1d9ff45dfedc33371d0899d01b5737fc7f9c0d0b5b2dc45dcd8b595

Contents?: true

Size: 1.77 KB

Versions: 14

Compression:

Stored size: 1.77 KB

Contents

require 'spec_helper'

module RubySpeech
  module SSML
    describe Desc do
      let(:doc) { Nokogiri::XML::Document.new }

      subject { described_class.new doc }

      its(:name) { should == 'desc' }

      describe "setting options in initializers" do
        subject { Desc.new doc, :language => 'foo' }

        its(:language) { should == 'foo' }
      end

      it 'registers itself' do
        Element.class_from_registration(:desc).should == Desc
      end

      describe "from a document" do
        let(:document) { '<desc xml:lang="en"/>' }

        subject { Element.import document }

        it { should be_instance_of Desc }

        its(:language) { should == 'en' }
      end

      describe "comparing objects" do
        it "should be equal if the content and language are the same" do
          Desc.new(doc, :language => 'jp', :content => "Hello there").should == Desc.new(doc, :language => 'jp', :content => "Hello there")
        end

        describe "when the content is different" do
          it "should not be equal" do
            Desc.new(doc, :content => "Hello").should_not == Desc.new(doc, :content => "Hello there")
          end
        end

        describe "when the language is different" do
          it "should not be equal" do
            Desc.new(doc, :language => 'jp').should_not == Desc.new(doc, :language => 'en')
          end
        end
      end

      describe "<<" do
        it "should accept String" do
          lambda { subject << 'anything' }.should_not raise_error
        end

        it "should raise InvalidChildError with non-acceptable objects" do
          lambda { subject << Voice.new(doc) }.should raise_error(InvalidChildError, "A Desc can only accept Strings as children")
        end
      end
    end # Desc
  end # SSML
end # RubySpeech

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
ruby_speech-2.4.0-java spec/ruby_speech/ssml/desc_spec.rb
ruby_speech-2.4.0 spec/ruby_speech/ssml/desc_spec.rb
ruby_speech-2.3.2-java spec/ruby_speech/ssml/desc_spec.rb
ruby_speech-2.3.2 spec/ruby_speech/ssml/desc_spec.rb
ruby_speech-2.3.1-java spec/ruby_speech/ssml/desc_spec.rb
ruby_speech-2.3.1 spec/ruby_speech/ssml/desc_spec.rb
ruby_speech-2.3.0-java spec/ruby_speech/ssml/desc_spec.rb
ruby_speech-2.3.0 spec/ruby_speech/ssml/desc_spec.rb
ruby_speech-2.2.2-java spec/ruby_speech/ssml/desc_spec.rb
ruby_speech-2.2.2 spec/ruby_speech/ssml/desc_spec.rb
ruby_speech-2.2.1-java spec/ruby_speech/ssml/desc_spec.rb
ruby_speech-2.2.1 spec/ruby_speech/ssml/desc_spec.rb
ruby_speech-2.2.0-java spec/ruby_speech/ssml/desc_spec.rb
ruby_speech-2.2.0 spec/ruby_speech/ssml/desc_spec.rb