Sha256: 60b2202568dd4ca05caa2e1a6e19638144ace5a6bee04b5935dd2286513541e5

Contents?: true

Size: 1.46 KB

Versions: 14

Compression:

Stored size: 1.46 KB

Contents

require 'spec_helper'

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

      subject { described_class.new doc }

      its(:name) { should == 'one-of' }

      it 'registers itself' do
        Element.class_from_registration(:'one-of').should == OneOf
      end

      describe "from a document" do
        let(:document) { '<one-of> <item>test</item> </one-of>' }

        subject { Element.import document }

        it { should be_instance_of OneOf }
      end

      describe "#language" do
        before { subject.language = 'fr-CA' }

        its(:language) { should == 'fr-CA' }
      end

      describe "<<" do
        it "should accept Item" do
          lambda { subject << Item.new(doc) }.should_not raise_error
        end

        it "should raise InvalidChildError with non-acceptable objects" do
          lambda { subject << 1 }.should raise_error(InvalidChildError, "A OneOf can only accept Item as children")
        end
      end

      describe "comparing objects" do
        it "should be equal if the language (when specified) is the same" do
          OneOf.new(doc, :language => "jp").should == OneOf.new(doc, :language => "jp")
        end

        describe "when the language is different" do
          it "should not be equal" do
            OneOf.new(doc, :language => "jp").should_not == OneOf.new(doc, :content => "fr-CA")
          end
        end
      end
    end # OneOf
  end # GRXML
end # RubySpeech

Version data entries

14 entries across 14 versions & 1 rubygems

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