Sha256: be8bbd7403350bb97c51c1474a1790a80f25e17d705369384b0653e82a3b5806

Contents?: true

Size: 1.99 KB

Versions: 3

Compression:

Stored size: 1.99 KB

Contents

require 'spec_helper'

module RubySpeech
  module SSML
    describe SayAs do
      subject { SayAs.new 'one', format: 'two', detail: 'three' }

      its(:name) { should == 'say-as' }

      its(:interpret_as) { should == 'one' }
      its(:format)       { should == 'two' }
      its(:detail)       { should == 'three' }

      describe "without interpret_as" do
        it "should raise an ArgumentError" do
          expect { SayAs.new }.should raise_error(ArgumentError)
        end
      end

      describe "comparing objects" do
        it "should be equal if the content, interpret_as, format, age, variant, name are the same" do
          SayAs.new('jp', format: 'foo', detail: 'bar', content: "hello").should == SayAs.new('jp', format: 'foo', detail: 'bar', content: "hello")
        end

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

        describe "when the interpret_as is different" do
          it "should not be equal" do
            SayAs.new("Hello").should_not == SayAs.new("Hello there")
          end
        end

        describe "when the format is different" do
          it "should not be equal" do
            SayAs.new('jp', format: 'foo').should_not == SayAs.new('jp', format: 'bar')
          end
        end

        describe "when the detail is different" do
          it "should not be equal" do
            SayAs.new('jp', detail: 'foo').should_not == SayAs.new('jp', detail: 'bar')
          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 }.should raise_error(InvalidChildError, "A SayAs can only accept Strings as children")
        end
      end
    end # SayAs
  end # SSML
end # RubySpeech

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby_speech-0.1.2 spec/ruby_speech/ssml/say_as_spec.rb
ruby_speech-0.1.1 spec/ruby_speech/ssml/say_as_spec.rb
ruby_speech-0.1.0 spec/ruby_speech/ssml/say_as_spec.rb