ruby_speech 2.4.0-java → 3.0.0-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +11 -23
- data/CHANGELOG.md +4 -0
- data/README.md +2 -2
- data/Rakefile +2 -0
- data/lib/ruby_speech/version.rb +1 -1
- data/ruby_speech.gemspec +3 -3
- data/spec/ruby_speech/grxml/builtins_spec.rb +72 -72
- data/spec/ruby_speech/grxml/grammar_spec.rb +37 -37
- data/spec/ruby_speech/grxml/item_spec.rb +33 -33
- data/spec/ruby_speech/grxml/match_spec.rb +1 -1
- data/spec/ruby_speech/grxml/matcher_spec.rb +62 -62
- data/spec/ruby_speech/grxml/max_match_spec.rb +2 -2
- data/spec/ruby_speech/grxml/no_match_spec.rb +2 -2
- data/spec/ruby_speech/grxml/one_of_spec.rb +6 -6
- data/spec/ruby_speech/grxml/potential_match_spec.rb +2 -2
- data/spec/ruby_speech/grxml/rule_spec.rb +17 -17
- data/spec/ruby_speech/grxml/ruleref_spec.rb +10 -10
- data/spec/ruby_speech/grxml/tag_spec.rb +5 -5
- data/spec/ruby_speech/grxml/token_spec.rb +7 -7
- data/spec/ruby_speech/grxml_spec.rb +24 -24
- data/spec/ruby_speech/nlsml_spec.rb +11 -11
- data/spec/ruby_speech/ssml/audio_spec.rb +19 -19
- data/spec/ruby_speech/ssml/break_spec.rb +16 -16
- data/spec/ruby_speech/ssml/desc_spec.rb +7 -7
- data/spec/ruby_speech/ssml/emphasis_spec.rb +21 -21
- data/spec/ruby_speech/ssml/mark_spec.rb +5 -5
- data/spec/ruby_speech/ssml/p_spec.rb +17 -17
- data/spec/ruby_speech/ssml/phoneme_spec.rb +8 -8
- data/spec/ruby_speech/ssml/prosody_spec.rb +61 -61
- data/spec/ruby_speech/ssml/s_spec.rb +16 -16
- data/spec/ruby_speech/ssml/say_as_spec.rb +9 -9
- data/spec/ruby_speech/ssml/speak_spec.rb +29 -29
- data/spec/ruby_speech/ssml/sub_spec.rb +7 -7
- data/spec/ruby_speech/ssml/voice_spec.rb +31 -31
- data/spec/ruby_speech/ssml_spec.rb +20 -20
- data/spec/ruby_speech_spec.rb +3 -3
- data/spec/spec_helper.rb +0 -1
- data/spec/support/grammar_matchers.rb +6 -6
- data/spec/support/match_examples.rb +5 -5
- data/spec/support/matchers.rb +1 -1
- metadata +17 -11
@@ -16,7 +16,7 @@ module RubySpeech
|
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'registers itself' do
|
19
|
-
Element.class_from_registration(:s).
|
19
|
+
expect(Element.class_from_registration(:s)).to eq(S)
|
20
20
|
end
|
21
21
|
|
22
22
|
describe "from a document" do
|
@@ -24,71 +24,71 @@ module RubySpeech
|
|
24
24
|
|
25
25
|
subject { Element.import document }
|
26
26
|
|
27
|
-
it {
|
27
|
+
it { is_expected.to be_instance_of S }
|
28
28
|
its(:content) { should == 'foo' }
|
29
29
|
end
|
30
30
|
|
31
31
|
describe "comparing objects" do
|
32
32
|
it "should be equal if the content and language are the same" do
|
33
|
-
S.new(doc, :language => 'jp', :content => "Hello there").
|
33
|
+
expect(S.new(doc, :language => 'jp', :content => "Hello there")).to eq(S.new(doc, :language => 'jp', :content => "Hello there"))
|
34
34
|
end
|
35
35
|
|
36
36
|
describe "when the content is different" do
|
37
37
|
it "should not be equal" do
|
38
|
-
S.new(doc, :content => "Hello").
|
38
|
+
expect(S.new(doc, :content => "Hello")).not_to eq(S.new(doc, :content => "Hello there"))
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
42
|
describe "when the language is different" do
|
43
43
|
it "should not be equal" do
|
44
|
-
S.new(doc, :language => 'jp').
|
44
|
+
expect(S.new(doc, :language => 'jp')).not_to eq(S.new(doc, :language => 'en'))
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
49
|
describe "<<" do
|
50
50
|
it "should accept String" do
|
51
|
-
|
51
|
+
expect { subject << 'anything' }.not_to raise_error
|
52
52
|
end
|
53
53
|
|
54
54
|
it "should accept Audio" do
|
55
|
-
|
55
|
+
expect { subject << Audio.new(doc) }.not_to raise_error
|
56
56
|
end
|
57
57
|
|
58
58
|
it "should accept Break" do
|
59
|
-
|
59
|
+
expect { subject << Break.new(doc) }.not_to raise_error
|
60
60
|
end
|
61
61
|
|
62
62
|
it "should accept Emphasis" do
|
63
|
-
|
63
|
+
expect { subject << Emphasis.new(doc) }.not_to raise_error
|
64
64
|
end
|
65
65
|
|
66
66
|
it "should accept Mark" do
|
67
|
-
|
67
|
+
expect { subject << Mark.new(doc) }.not_to raise_error
|
68
68
|
end
|
69
69
|
|
70
70
|
it "should accept Phoneme" do
|
71
|
-
|
71
|
+
expect { subject << Phoneme.new(doc) }.not_to raise_error
|
72
72
|
end
|
73
73
|
|
74
74
|
it "should accept Prosody" do
|
75
|
-
|
75
|
+
expect { subject << Prosody.new(doc) }.not_to raise_error
|
76
76
|
end
|
77
77
|
|
78
78
|
it "should accept SayAs" do
|
79
|
-
|
79
|
+
expect { subject << SayAs.new(doc, :interpret_as => :foo) }.not_to raise_error
|
80
80
|
end
|
81
81
|
|
82
82
|
it "should accept Sub" do
|
83
|
-
|
83
|
+
expect { subject << Sub.new(doc) }.not_to raise_error
|
84
84
|
end
|
85
85
|
|
86
86
|
it "should accept Voice" do
|
87
|
-
|
87
|
+
expect { subject << Voice.new(doc) }.not_to raise_error
|
88
88
|
end
|
89
89
|
|
90
90
|
it "should raise InvalidChildError with non-acceptable objects" do
|
91
|
-
|
91
|
+
expect { subject << 1 }.to raise_error(InvalidChildError, "An S can only accept String, Audio, Break, Emphasis, Mark, Phoneme, Prosody, SayAs, Sub, Voice as children")
|
92
92
|
end
|
93
93
|
end
|
94
94
|
end # S
|
@@ -16,7 +16,7 @@ module RubySpeech
|
|
16
16
|
its(:detail) { should == 'three' }
|
17
17
|
|
18
18
|
it 'registers itself' do
|
19
|
-
Element.class_from_registration(:'say-as').
|
19
|
+
expect(Element.class_from_registration(:'say-as')).to eq(SayAs)
|
20
20
|
end
|
21
21
|
|
22
22
|
describe "from a document" do
|
@@ -24,7 +24,7 @@ module RubySpeech
|
|
24
24
|
|
25
25
|
subject { Element.import document }
|
26
26
|
|
27
|
-
it {
|
27
|
+
it { is_expected.to be_instance_of SayAs }
|
28
28
|
|
29
29
|
its(:interpret_as) { should == 'one' }
|
30
30
|
its(:format) { should == 'two' }
|
@@ -33,41 +33,41 @@ module RubySpeech
|
|
33
33
|
|
34
34
|
describe "comparing objects" do
|
35
35
|
it "should be equal if the content, interpret_as, format, age, variant, name are the same" do
|
36
|
-
SayAs.new(doc, :interpret_as => 'jp', :format => 'foo', :detail => 'bar', :content => "hello").
|
36
|
+
expect(SayAs.new(doc, :interpret_as => 'jp', :format => 'foo', :detail => 'bar', :content => "hello")).to eq(SayAs.new(doc, :interpret_as => 'jp', :format => 'foo', :detail => 'bar', :content => "hello"))
|
37
37
|
end
|
38
38
|
|
39
39
|
describe "when the content is different" do
|
40
40
|
it "should not be equal" do
|
41
|
-
SayAs.new(doc, :interpret_as => 'jp', :content => "Hello").
|
41
|
+
expect(SayAs.new(doc, :interpret_as => 'jp', :content => "Hello")).not_to eq(SayAs.new(doc, :interpret_as => 'jp', :content => "Hello there"))
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
45
|
describe "when the interpret_as is different" do
|
46
46
|
it "should not be equal" do
|
47
|
-
SayAs.new(doc, :interpret_as => "Hello").
|
47
|
+
expect(SayAs.new(doc, :interpret_as => "Hello")).not_to eq(SayAs.new(doc, :interpret_as => "Hello there"))
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
51
|
describe "when the format is different" do
|
52
52
|
it "should not be equal" do
|
53
|
-
SayAs.new(doc, :interpret_as => 'jp', :format => 'foo').
|
53
|
+
expect(SayAs.new(doc, :interpret_as => 'jp', :format => 'foo')).not_to eq(SayAs.new(doc, :interpret_as => 'jp', :format => 'bar'))
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
57
|
describe "when the detail is different" do
|
58
58
|
it "should not be equal" do
|
59
|
-
SayAs.new(doc, :interpret_as => 'jp', :detail => 'foo').
|
59
|
+
expect(SayAs.new(doc, :interpret_as => 'jp', :detail => 'foo')).not_to eq(SayAs.new(doc, :interpret_as => 'jp', :detail => 'bar'))
|
60
60
|
end
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
64
|
describe "<<" do
|
65
65
|
it "should accept String" do
|
66
|
-
|
66
|
+
expect { subject << 'anything' }.not_to raise_error
|
67
67
|
end
|
68
68
|
|
69
69
|
it "should raise InvalidChildError with non-acceptable objects" do
|
70
|
-
|
70
|
+
expect { subject << Voice.new(doc) }.to raise_error(InvalidChildError, "A SayAs can only accept Strings as children")
|
71
71
|
end
|
72
72
|
end
|
73
73
|
end # SayAs
|
@@ -7,7 +7,7 @@ module RubySpeech
|
|
7
7
|
|
8
8
|
subject { described_class.new doc }
|
9
9
|
|
10
|
-
it {
|
10
|
+
it { is_expected.to be_a_valid_ssml_document }
|
11
11
|
|
12
12
|
its(:name) { should == 'speak' }
|
13
13
|
its(:language) { should == 'en-US' }
|
@@ -20,7 +20,7 @@ module RubySpeech
|
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'registers itself' do
|
23
|
-
Element.class_from_registration(:speak).
|
23
|
+
expect(Element.class_from_registration(:speak)).to eq(Speak)
|
24
24
|
end
|
25
25
|
|
26
26
|
describe "from a document" do
|
@@ -28,7 +28,7 @@ module RubySpeech
|
|
28
28
|
|
29
29
|
subject { Element.import document }
|
30
30
|
|
31
|
-
it {
|
31
|
+
it { is_expected.to be_instance_of Speak }
|
32
32
|
|
33
33
|
its(:language) { should == 'jp' }
|
34
34
|
its(:base_uri) { should == 'blah' }
|
@@ -48,24 +48,24 @@ module RubySpeech
|
|
48
48
|
|
49
49
|
describe "comparing objects" do
|
50
50
|
it "should be equal if the content, language and base uri are the same" do
|
51
|
-
Speak.new(doc, :language => 'en-GB', :base_uri => 'blah', :content => "Hello there").
|
51
|
+
expect(Speak.new(doc, :language => 'en-GB', :base_uri => 'blah', :content => "Hello there")).to eq(Speak.new(doc, :language => 'en-GB', :base_uri => 'blah', :content => "Hello there"))
|
52
52
|
end
|
53
53
|
|
54
54
|
describe "when the content is different" do
|
55
55
|
it "should not be equal" do
|
56
|
-
Speak.new(doc, :content => "Hello").
|
56
|
+
expect(Speak.new(doc, :content => "Hello")).not_to eq(Speak.new(doc, :content => "Hello there"))
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
60
|
describe "when the language is different" do
|
61
61
|
it "should not be equal" do
|
62
|
-
Speak.new(doc, :language => 'en-US').
|
62
|
+
expect(Speak.new(doc, :language => 'en-US')).not_to eq(Speak.new(doc, :language => 'en-GB'))
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
66
|
describe "when the base URI is different" do
|
67
67
|
it "should not be equal" do
|
68
|
-
Speak.new(doc, :base_uri => 'foo').
|
68
|
+
expect(Speak.new(doc, :base_uri => 'foo')).not_to eq(Speak.new(doc, :base_uri => 'bar'))
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
@@ -76,7 +76,7 @@ module RubySpeech
|
|
76
76
|
s2 = Speak.new doc
|
77
77
|
s2 << SayAs.new(doc, :interpret_as => 'time')
|
78
78
|
|
79
|
-
s1.
|
79
|
+
expect(s1).not_to eq(s2)
|
80
80
|
end
|
81
81
|
end
|
82
82
|
end
|
@@ -86,66 +86,66 @@ module RubySpeech
|
|
86
86
|
s.voice :gender => :male, :content => 'Hello'
|
87
87
|
expected_s = Speak.new doc
|
88
88
|
expected_s << Voice.new(doc, :gender => :male, :content => 'Hello')
|
89
|
-
s.
|
89
|
+
expect(s).to eq(expected_s)
|
90
90
|
end
|
91
91
|
|
92
92
|
describe "<<" do
|
93
93
|
it "should accept String" do
|
94
|
-
|
94
|
+
expect { subject << 'anything' }.not_to raise_error
|
95
95
|
end
|
96
96
|
|
97
97
|
it "should accept Audio" do
|
98
|
-
|
98
|
+
expect { subject << Audio.new(doc) }.not_to raise_error
|
99
99
|
end
|
100
100
|
|
101
101
|
it "should accept Break" do
|
102
|
-
|
102
|
+
expect { subject << Break.new(doc) }.not_to raise_error
|
103
103
|
end
|
104
104
|
|
105
105
|
it "should accept Emphasis" do
|
106
|
-
|
106
|
+
expect { subject << Emphasis.new(doc) }.not_to raise_error
|
107
107
|
end
|
108
108
|
|
109
109
|
it "should accept Mark" do
|
110
|
-
|
110
|
+
expect { subject << Mark.new(doc) }.not_to raise_error
|
111
111
|
end
|
112
112
|
|
113
113
|
it "should accept P" do
|
114
|
-
|
114
|
+
expect { subject << P.new(doc) }.not_to raise_error
|
115
115
|
end
|
116
116
|
|
117
117
|
it "should accept Phoneme" do
|
118
|
-
|
118
|
+
expect { subject << Phoneme.new(doc) }.not_to raise_error
|
119
119
|
end
|
120
120
|
|
121
121
|
it "should accept Prosody" do
|
122
|
-
|
122
|
+
expect { subject << Prosody.new(doc) }.not_to raise_error
|
123
123
|
end
|
124
124
|
|
125
125
|
it "should accept SayAs" do
|
126
|
-
|
126
|
+
expect { subject << SayAs.new(doc, :interpret_as => :foo) }.not_to raise_error
|
127
127
|
end
|
128
128
|
|
129
129
|
it "should accept Sub" do
|
130
|
-
|
130
|
+
expect { subject << Sub.new(doc) }.not_to raise_error
|
131
131
|
end
|
132
132
|
|
133
133
|
it "should accept S" do
|
134
|
-
|
134
|
+
expect { subject << S.new(doc) }.not_to raise_error
|
135
135
|
end
|
136
136
|
|
137
137
|
it "should accept Voice" do
|
138
|
-
|
138
|
+
expect { subject << Voice.new(doc) }.not_to raise_error
|
139
139
|
end
|
140
140
|
|
141
141
|
it "should raise InvalidChildError with non-acceptable objects" do
|
142
|
-
|
142
|
+
expect { subject << 1 }.to raise_error(InvalidChildError, "A Speak can only accept String, Audio, Break, Emphasis, Mark, P, Phoneme, Prosody, SayAs, Sub, S, Voice as children")
|
143
143
|
end
|
144
144
|
end
|
145
145
|
|
146
146
|
describe "#to_doc" do
|
147
147
|
it "should create an XML document from the grammar" do
|
148
|
-
subject.to_doc.
|
148
|
+
expect(subject.to_doc).to eq(subject.document)
|
149
149
|
end
|
150
150
|
end
|
151
151
|
|
@@ -176,11 +176,11 @@ module RubySpeech
|
|
176
176
|
end
|
177
177
|
|
178
178
|
concat = (speak1 + speak2)
|
179
|
-
speak1.to_s.
|
180
|
-
speak2.to_s.
|
181
|
-
concat.
|
182
|
-
concat.document.root.
|
183
|
-
concat.to_s.
|
179
|
+
expect(speak1.to_s).to eq(speak1_string)
|
180
|
+
expect(speak2.to_s).to eq(speak2_string)
|
181
|
+
expect(concat).to eq(expected_concat)
|
182
|
+
expect(concat.document.root).to eq(concat)
|
183
|
+
expect(concat.to_s).not_to include('default')
|
184
184
|
end
|
185
185
|
|
186
186
|
context "when concatenating" do
|
@@ -199,7 +199,7 @@ module RubySpeech
|
|
199
199
|
end
|
200
200
|
|
201
201
|
concat = (speak1 + speak2)
|
202
|
-
concat.
|
202
|
+
expect(concat).to eq(expected_concat)
|
203
203
|
end
|
204
204
|
end
|
205
205
|
end
|
@@ -16,7 +16,7 @@ module RubySpeech
|
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'registers itself' do
|
19
|
-
Element.class_from_registration(:sub).
|
19
|
+
expect(Element.class_from_registration(:sub)).to eq(Sub)
|
20
20
|
end
|
21
21
|
|
22
22
|
describe "from a document" do
|
@@ -24,36 +24,36 @@ module RubySpeech
|
|
24
24
|
|
25
25
|
subject { Element.import document }
|
26
26
|
|
27
|
-
it {
|
27
|
+
it { is_expected.to be_instance_of Sub }
|
28
28
|
|
29
29
|
its(:alias) { should == 'foo' }
|
30
30
|
end
|
31
31
|
|
32
32
|
describe "comparing objects" do
|
33
33
|
it "should be equal if the content and alias are the same" do
|
34
|
-
Sub.new(doc, :alias => 'jp', :content => "Hello there").
|
34
|
+
expect(Sub.new(doc, :alias => 'jp', :content => "Hello there")).to eq(Sub.new(doc, :alias => 'jp', :content => "Hello there"))
|
35
35
|
end
|
36
36
|
|
37
37
|
describe "when the content is different" do
|
38
38
|
it "should not be equal" do
|
39
|
-
Sub.new(doc, :content => "Hello").
|
39
|
+
expect(Sub.new(doc, :content => "Hello")).not_to eq(Sub.new(doc, :content => "Hello there"))
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
43
|
describe "when the alias is different" do
|
44
44
|
it "should not be equal" do
|
45
|
-
Sub.new(doc, :alias => 'jp').
|
45
|
+
expect(Sub.new(doc, :alias => 'jp')).not_to eq(Sub.new(doc, :alias => 'en'))
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
50
|
describe "<<" do
|
51
51
|
it "should accept String" do
|
52
|
-
|
52
|
+
expect { subject << 'anything' }.not_to raise_error
|
53
53
|
end
|
54
54
|
|
55
55
|
it "should raise InvalidChildError with non-acceptable objects" do
|
56
|
-
|
56
|
+
expect { subject << Voice.new(doc) }.to raise_error(InvalidChildError, "A Sub can only accept Strings as children")
|
57
57
|
end
|
58
58
|
end
|
59
59
|
end # Desc
|
@@ -21,7 +21,7 @@ module RubySpeech
|
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'registers itself' do
|
24
|
-
Element.class_from_registration(:voice).
|
24
|
+
expect(Element.class_from_registration(:voice)).to eq(Voice)
|
25
25
|
end
|
26
26
|
|
27
27
|
describe "from a document" do
|
@@ -29,7 +29,7 @@ module RubySpeech
|
|
29
29
|
|
30
30
|
subject { Element.import document }
|
31
31
|
|
32
|
-
it {
|
32
|
+
it { is_expected.to be_instance_of Voice }
|
33
33
|
|
34
34
|
its(:language) { should == 'jp' }
|
35
35
|
its(:gender) { should == :male }
|
@@ -50,13 +50,13 @@ module RubySpeech
|
|
50
50
|
its(:gender) { should == :male }
|
51
51
|
|
52
52
|
it "with a valid gender" do
|
53
|
-
|
54
|
-
|
55
|
-
|
53
|
+
expect { subject.gender = :male }.not_to raise_error
|
54
|
+
expect { subject.gender = :female }.not_to raise_error
|
55
|
+
expect { subject.gender = :neutral }.not_to raise_error
|
56
56
|
end
|
57
57
|
|
58
58
|
it "with an invalid gender" do
|
59
|
-
|
59
|
+
expect { subject.gender = :something }.to raise_error(ArgumentError, "You must specify a valid gender (:male, :female, :neutral)")
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
@@ -66,15 +66,15 @@ module RubySpeech
|
|
66
66
|
its(:age) { should == 12 }
|
67
67
|
|
68
68
|
it "with an integer of 0" do
|
69
|
-
|
69
|
+
expect { subject.age = 0 }.not_to raise_error
|
70
70
|
end
|
71
71
|
|
72
72
|
it "with an integer less than 0" do
|
73
|
-
|
73
|
+
expect { subject.age = -1 }.to raise_error(ArgumentError, "You must specify a valid age (non-negative integer)")
|
74
74
|
end
|
75
75
|
|
76
76
|
it "with something other than an integer" do
|
77
|
-
|
77
|
+
expect { subject.age = "bah" }.to raise_error(ArgumentError, "You must specify a valid age (non-negative integer)")
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
@@ -84,11 +84,11 @@ module RubySpeech
|
|
84
84
|
its(:variant) { should == 12 }
|
85
85
|
|
86
86
|
it "with an integer less than 1" do
|
87
|
-
|
87
|
+
expect { subject.variant = 0 }.to raise_error(ArgumentError, "You must specify a valid variant (positive integer)")
|
88
88
|
end
|
89
89
|
|
90
90
|
it "with something other than an integer" do
|
91
|
-
|
91
|
+
expect { subject.variant = "bah" }.to raise_error(ArgumentError, "You must specify a valid variant (positive integer)")
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
@@ -106,97 +106,97 @@ module RubySpeech
|
|
106
106
|
|
107
107
|
describe "comparing objects" do
|
108
108
|
it "should be equal if the content, language, gender, age, variant, name are the same" do
|
109
|
-
Voice.new(doc, :language => 'jp', :gender => :male, :age => 25, :variant => 2, :name => "paul", :content => "hello").
|
109
|
+
expect(Voice.new(doc, :language => 'jp', :gender => :male, :age => 25, :variant => 2, :name => "paul", :content => "hello")).to eq(Voice.new(doc, :language => 'jp', :gender => :male, :age => 25, :variant => 2, :name => "paul", :content => "hello"))
|
110
110
|
end
|
111
111
|
|
112
112
|
describe "when the content is different" do
|
113
113
|
it "should not be equal" do
|
114
|
-
Voice.new(doc, :content => "Hello").
|
114
|
+
expect(Voice.new(doc, :content => "Hello")).not_to eq(Voice.new(doc, :content => "Hello there"))
|
115
115
|
end
|
116
116
|
end
|
117
117
|
|
118
118
|
describe "when the language is different" do
|
119
119
|
it "should not be equal" do
|
120
|
-
Voice.new(doc, :language => "Hello").
|
120
|
+
expect(Voice.new(doc, :language => "Hello")).not_to eq(Voice.new(doc, :language => "Hello there"))
|
121
121
|
end
|
122
122
|
end
|
123
123
|
|
124
124
|
describe "when the gender is different" do
|
125
125
|
it "should not be equal" do
|
126
|
-
Voice.new(doc, :gender => :male).
|
126
|
+
expect(Voice.new(doc, :gender => :male)).not_to eq(Voice.new(doc, :gender => :female))
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
130
130
|
describe "when the age is different" do
|
131
131
|
it "should not be equal" do
|
132
|
-
Voice.new(doc, :age => 20).
|
132
|
+
expect(Voice.new(doc, :age => 20)).not_to eq(Voice.new(doc, :age => 30))
|
133
133
|
end
|
134
134
|
end
|
135
135
|
|
136
136
|
describe "when the variant is different" do
|
137
137
|
it "should not be equal" do
|
138
|
-
Voice.new(doc, :variant => 1).
|
138
|
+
expect(Voice.new(doc, :variant => 1)).not_to eq(Voice.new(doc, :variant => 2))
|
139
139
|
end
|
140
140
|
end
|
141
141
|
|
142
142
|
describe "when the name is different" do
|
143
143
|
it "should not be equal" do
|
144
|
-
Voice.new(doc, :name => "Hello").
|
144
|
+
expect(Voice.new(doc, :name => "Hello")).not_to eq(Voice.new(doc, :name => "Hello there"))
|
145
145
|
end
|
146
146
|
end
|
147
147
|
end
|
148
148
|
|
149
149
|
describe "<<" do
|
150
150
|
it "should accept String" do
|
151
|
-
|
151
|
+
expect { subject << 'anything' }.not_to raise_error
|
152
152
|
end
|
153
153
|
|
154
154
|
it "should accept Audio" do
|
155
|
-
|
155
|
+
expect { subject << Audio.new(doc) }.not_to raise_error
|
156
156
|
end
|
157
157
|
|
158
158
|
it "should accept Break" do
|
159
|
-
|
159
|
+
expect { subject << Break.new(doc) }.not_to raise_error
|
160
160
|
end
|
161
161
|
|
162
162
|
it "should accept Emphasis" do
|
163
|
-
|
163
|
+
expect { subject << Emphasis.new(doc) }.not_to raise_error
|
164
164
|
end
|
165
165
|
|
166
166
|
it "should accept Mark" do
|
167
|
-
|
167
|
+
expect { subject << Mark.new(doc) }.not_to raise_error
|
168
168
|
end
|
169
169
|
|
170
170
|
it "should accept P" do
|
171
|
-
|
171
|
+
expect { subject << P.new(doc) }.not_to raise_error
|
172
172
|
end
|
173
173
|
|
174
174
|
it "should accept Phoneme" do
|
175
|
-
|
175
|
+
expect { subject << Phoneme.new(doc) }.not_to raise_error
|
176
176
|
end
|
177
177
|
|
178
178
|
it "should accept Prosody" do
|
179
|
-
|
179
|
+
expect { subject << Prosody.new(doc) }.not_to raise_error
|
180
180
|
end
|
181
181
|
|
182
182
|
it "should accept SayAs" do
|
183
|
-
|
183
|
+
expect { subject << SayAs.new(doc, :interpret_as => :foo) }.not_to raise_error
|
184
184
|
end
|
185
185
|
|
186
186
|
it "should accept Sub" do
|
187
|
-
|
187
|
+
expect { subject << Sub.new(doc) }.not_to raise_error
|
188
188
|
end
|
189
189
|
|
190
190
|
it "should accept S" do
|
191
|
-
|
191
|
+
expect { subject << S.new(doc) }.not_to raise_error
|
192
192
|
end
|
193
193
|
|
194
194
|
it "should accept Voice" do
|
195
|
-
|
195
|
+
expect { subject << Voice.new(doc) }.not_to raise_error
|
196
196
|
end
|
197
197
|
|
198
198
|
it "should raise InvalidChildError with non-acceptable objects" do
|
199
|
-
|
199
|
+
expect { subject << 1 }.to raise_error(InvalidChildError, "A Voice can only accept String, Audio, Break, Emphasis, Mark, P, Phoneme, Prosody, SayAs, Sub, S, Voice as children")
|
200
200
|
end
|
201
201
|
end
|
202
202
|
end # Voice
|