ruby_speech 2.1.2 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -2
- data/CHANGELOG.md +8 -0
- data/README.md +23 -0
- data/ext/ruby_speech/extconf.rb +3 -1
- data/ext/ruby_speech/ruby_speech.c +4 -1
- data/lib/ruby_speech.rb +6 -19
- data/lib/ruby_speech/generic_element.rb +141 -29
- data/lib/ruby_speech/grxml.rb +16 -22
- data/lib/ruby_speech/grxml/element.rb +6 -6
- data/lib/ruby_speech/grxml/grammar.rb +29 -12
- data/lib/ruby_speech/grxml/item.rb +13 -0
- data/lib/ruby_speech/grxml/matcher.rb +5 -1
- data/lib/ruby_speech/grxml/one_of.rb +4 -0
- data/lib/ruby_speech/grxml/rule.rb +10 -0
- data/lib/ruby_speech/grxml/token.rb +3 -0
- data/lib/ruby_speech/nlsml.rb +3 -9
- data/lib/ruby_speech/ssml.rb +20 -22
- data/lib/ruby_speech/ssml/audio.rb +17 -0
- data/lib/ruby_speech/ssml/desc.rb +4 -0
- data/lib/ruby_speech/ssml/element.rb +5 -3
- data/lib/ruby_speech/ssml/emphasis.rb +17 -0
- data/lib/ruby_speech/ssml/mark.rb +2 -0
- data/lib/ruby_speech/ssml/p.rb +21 -0
- data/lib/ruby_speech/ssml/phoneme.rb +2 -0
- data/lib/ruby_speech/ssml/prosody.rb +15 -0
- data/lib/ruby_speech/ssml/s.rb +20 -0
- data/lib/ruby_speech/ssml/say_as.rb +2 -0
- data/lib/ruby_speech/ssml/speak.rb +19 -1
- data/lib/ruby_speech/ssml/sub.rb +2 -0
- data/lib/ruby_speech/ssml/voice.rb +19 -0
- data/lib/ruby_speech/version.rb +1 -1
- data/ruby_speech.gemspec +2 -3
- data/spec/ruby_speech/grxml/grammar_spec.rb +35 -30
- data/spec/ruby_speech/grxml/item_spec.rb +8 -6
- data/spec/ruby_speech/grxml/one_of_spec.rb +7 -3
- data/spec/ruby_speech/grxml/rule_spec.rb +14 -12
- data/spec/ruby_speech/grxml/ruleref_spec.rb +5 -3
- data/spec/ruby_speech/grxml/tag_spec.rb +6 -2
- data/spec/ruby_speech/grxml/token_spec.rb +6 -2
- data/spec/ruby_speech/grxml_spec.rb +57 -69
- data/spec/ruby_speech/ssml/audio_spec.rb +20 -16
- data/spec/ruby_speech/ssml/break_spec.rb +14 -10
- data/spec/ruby_speech/ssml/desc_spec.rb +9 -5
- data/spec/ruby_speech/ssml/emphasis_spec.rb +17 -13
- data/spec/ruby_speech/ssml/mark_spec.rb +7 -3
- data/spec/ruby_speech/ssml/p_spec.rb +18 -14
- data/spec/ruby_speech/ssml/phoneme_spec.rb +10 -6
- data/spec/ruby_speech/ssml/prosody_spec.rb +29 -25
- data/spec/ruby_speech/ssml/s_spec.rb +17 -13
- data/spec/ruby_speech/ssml/say_as_spec.rb +11 -7
- data/spec/ruby_speech/ssml/speak_spec.rb +48 -32
- data/spec/ruby_speech/ssml/sub_spec.rb +9 -5
- data/spec/ruby_speech/ssml/voice_spec.rb +23 -19
- data/spec/ruby_speech/ssml_spec.rb +64 -63
- data/spec/spec_helper.rb +0 -3
- metadata +10 -31
- data/lib/ruby_speech/xml.rb +0 -11
@@ -3,10 +3,14 @@ require 'spec_helper'
|
|
3
3
|
module RubySpeech
|
4
4
|
module SSML
|
5
5
|
describe S do
|
6
|
+
let(:doc) { Nokogiri::XML::Document.new }
|
7
|
+
|
8
|
+
subject { described_class.new doc }
|
9
|
+
|
6
10
|
its(:name) { should == 's' }
|
7
11
|
|
8
12
|
describe "setting options in initializers" do
|
9
|
-
subject { S.new :language => 'jp' }
|
13
|
+
subject { S.new doc, :language => 'jp' }
|
10
14
|
|
11
15
|
its(:language) { should == 'jp' }
|
12
16
|
end
|
@@ -26,18 +30,18 @@ module RubySpeech
|
|
26
30
|
|
27
31
|
describe "comparing objects" do
|
28
32
|
it "should be equal if the content and language are the same" do
|
29
|
-
S.new(:language => 'jp', :content => "Hello there").should == S.new(:language => 'jp', :content => "Hello there")
|
33
|
+
S.new(doc, :language => 'jp', :content => "Hello there").should == S.new(doc, :language => 'jp', :content => "Hello there")
|
30
34
|
end
|
31
35
|
|
32
36
|
describe "when the content is different" do
|
33
37
|
it "should not be equal" do
|
34
|
-
S.new(:content => "Hello").should_not == S.new(:content => "Hello there")
|
38
|
+
S.new(doc, :content => "Hello").should_not == S.new(doc, :content => "Hello there")
|
35
39
|
end
|
36
40
|
end
|
37
41
|
|
38
42
|
describe "when the language is different" do
|
39
43
|
it "should not be equal" do
|
40
|
-
S.new(:language => 'jp').should_not == S.new(:language => 'en')
|
44
|
+
S.new(doc, :language => 'jp').should_not == S.new(doc, :language => 'en')
|
41
45
|
end
|
42
46
|
end
|
43
47
|
end
|
@@ -48,39 +52,39 @@ module RubySpeech
|
|
48
52
|
end
|
49
53
|
|
50
54
|
it "should accept Audio" do
|
51
|
-
lambda { subject << Audio.new }.should_not raise_error
|
55
|
+
lambda { subject << Audio.new(doc) }.should_not raise_error
|
52
56
|
end
|
53
57
|
|
54
58
|
it "should accept Break" do
|
55
|
-
lambda { subject << Break.new }.should_not raise_error
|
59
|
+
lambda { subject << Break.new(doc) }.should_not raise_error
|
56
60
|
end
|
57
61
|
|
58
62
|
it "should accept Emphasis" do
|
59
|
-
lambda { subject << Emphasis.new }.should_not raise_error
|
63
|
+
lambda { subject << Emphasis.new(doc) }.should_not raise_error
|
60
64
|
end
|
61
65
|
|
62
66
|
it "should accept Mark" do
|
63
|
-
lambda { subject << Mark.new }.should_not raise_error
|
67
|
+
lambda { subject << Mark.new(doc) }.should_not raise_error
|
64
68
|
end
|
65
69
|
|
66
70
|
it "should accept Phoneme" do
|
67
|
-
lambda { subject << Phoneme.new }.should_not raise_error
|
71
|
+
lambda { subject << Phoneme.new(doc) }.should_not raise_error
|
68
72
|
end
|
69
73
|
|
70
74
|
it "should accept Prosody" do
|
71
|
-
lambda { subject << Prosody.new }.should_not raise_error
|
75
|
+
lambda { subject << Prosody.new(doc) }.should_not raise_error
|
72
76
|
end
|
73
77
|
|
74
78
|
it "should accept SayAs" do
|
75
|
-
lambda { subject << SayAs.new(:interpret_as => :foo) }.should_not raise_error
|
79
|
+
lambda { subject << SayAs.new(doc, :interpret_as => :foo) }.should_not raise_error
|
76
80
|
end
|
77
81
|
|
78
82
|
it "should accept Sub" do
|
79
|
-
lambda { subject << Sub.new }.should_not raise_error
|
83
|
+
lambda { subject << Sub.new(doc) }.should_not raise_error
|
80
84
|
end
|
81
85
|
|
82
86
|
it "should accept Voice" do
|
83
|
-
lambda { subject << Voice.new }.should_not raise_error
|
87
|
+
lambda { subject << Voice.new(doc) }.should_not raise_error
|
84
88
|
end
|
85
89
|
|
86
90
|
it "should raise InvalidChildError with non-acceptable objects" do
|
@@ -3,7 +3,11 @@ require 'spec_helper'
|
|
3
3
|
module RubySpeech
|
4
4
|
module SSML
|
5
5
|
describe SayAs do
|
6
|
-
|
6
|
+
let(:doc) { Nokogiri::XML::Document.new }
|
7
|
+
|
8
|
+
subject { described_class.new doc }
|
9
|
+
|
10
|
+
subject { SayAs.new doc, :interpret_as => 'one', :format => 'two', :detail => 'three' }
|
7
11
|
|
8
12
|
its(:name) { should == 'say-as' }
|
9
13
|
|
@@ -29,30 +33,30 @@ module RubySpeech
|
|
29
33
|
|
30
34
|
describe "comparing objects" do
|
31
35
|
it "should be equal if the content, interpret_as, format, age, variant, name are the same" do
|
32
|
-
SayAs.new(:interpret_as => 'jp', :format => 'foo', :detail => 'bar', :content => "hello").should == SayAs.new(:interpret_as => 'jp', :format => 'foo', :detail => 'bar', :content => "hello")
|
36
|
+
SayAs.new(doc, :interpret_as => 'jp', :format => 'foo', :detail => 'bar', :content => "hello").should == SayAs.new(doc, :interpret_as => 'jp', :format => 'foo', :detail => 'bar', :content => "hello")
|
33
37
|
end
|
34
38
|
|
35
39
|
describe "when the content is different" do
|
36
40
|
it "should not be equal" do
|
37
|
-
SayAs.new(:interpret_as => 'jp', :content => "Hello").should_not == SayAs.new(:interpret_as => 'jp', :content => "Hello there")
|
41
|
+
SayAs.new(doc, :interpret_as => 'jp', :content => "Hello").should_not == SayAs.new(doc, :interpret_as => 'jp', :content => "Hello there")
|
38
42
|
end
|
39
43
|
end
|
40
44
|
|
41
45
|
describe "when the interpret_as is different" do
|
42
46
|
it "should not be equal" do
|
43
|
-
SayAs.new(:interpret_as => "Hello").should_not == SayAs.new(:interpret_as => "Hello there")
|
47
|
+
SayAs.new(doc, :interpret_as => "Hello").should_not == SayAs.new(doc, :interpret_as => "Hello there")
|
44
48
|
end
|
45
49
|
end
|
46
50
|
|
47
51
|
describe "when the format is different" do
|
48
52
|
it "should not be equal" do
|
49
|
-
SayAs.new(:interpret_as => 'jp', :format => 'foo').should_not == SayAs.new(:interpret_as => 'jp', :format => 'bar')
|
53
|
+
SayAs.new(doc, :interpret_as => 'jp', :format => 'foo').should_not == SayAs.new(doc, :interpret_as => 'jp', :format => 'bar')
|
50
54
|
end
|
51
55
|
end
|
52
56
|
|
53
57
|
describe "when the detail is different" do
|
54
58
|
it "should not be equal" do
|
55
|
-
SayAs.new(:interpret_as => 'jp', :detail => 'foo').should_not == SayAs.new(:interpret_as => 'jp', :detail => 'bar')
|
59
|
+
SayAs.new(doc, :interpret_as => 'jp', :detail => 'foo').should_not == SayAs.new(doc, :interpret_as => 'jp', :detail => 'bar')
|
56
60
|
end
|
57
61
|
end
|
58
62
|
end
|
@@ -63,7 +67,7 @@ module RubySpeech
|
|
63
67
|
end
|
64
68
|
|
65
69
|
it "should raise InvalidChildError with non-acceptable objects" do
|
66
|
-
lambda { subject << Voice.new }.should raise_error(InvalidChildError, "A SayAs can only accept Strings as children")
|
70
|
+
lambda { subject << Voice.new(doc) }.should raise_error(InvalidChildError, "A SayAs can only accept Strings as children")
|
67
71
|
end
|
68
72
|
end
|
69
73
|
end # SayAs
|
@@ -3,13 +3,17 @@ require 'spec_helper'
|
|
3
3
|
module RubySpeech
|
4
4
|
module SSML
|
5
5
|
describe Speak do
|
6
|
+
let(:doc) { Nokogiri::XML::Document.new }
|
7
|
+
|
8
|
+
subject { described_class.new doc }
|
9
|
+
|
6
10
|
it { should be_a_valid_ssml_document }
|
7
11
|
|
8
12
|
its(:name) { should == 'speak' }
|
9
13
|
its(:language) { should == 'en-US' }
|
10
14
|
|
11
15
|
describe "setting options in initializers" do
|
12
|
-
subject { Speak.new :language => 'jp', :base_uri => 'blah' }
|
16
|
+
subject { Speak.new doc, :language => 'jp', :base_uri => 'blah' }
|
13
17
|
|
14
18
|
its(:language) { should == 'jp' }
|
15
19
|
its(:base_uri) { should == 'blah' }
|
@@ -44,33 +48,33 @@ module RubySpeech
|
|
44
48
|
|
45
49
|
describe "comparing objects" do
|
46
50
|
it "should be equal if the content, language and base uri are the same" do
|
47
|
-
Speak.new(:language => 'en-GB', :base_uri => 'blah', :content => "Hello there").should == Speak.new(:language => 'en-GB', :base_uri => 'blah', :content => "Hello there")
|
51
|
+
Speak.new(doc, :language => 'en-GB', :base_uri => 'blah', :content => "Hello there").should == Speak.new(doc, :language => 'en-GB', :base_uri => 'blah', :content => "Hello there")
|
48
52
|
end
|
49
53
|
|
50
54
|
describe "when the content is different" do
|
51
55
|
it "should not be equal" do
|
52
|
-
Speak.new(:content => "Hello").should_not == Speak.new(:content => "Hello there")
|
56
|
+
Speak.new(doc, :content => "Hello").should_not == Speak.new(doc, :content => "Hello there")
|
53
57
|
end
|
54
58
|
end
|
55
59
|
|
56
60
|
describe "when the language is different" do
|
57
61
|
it "should not be equal" do
|
58
|
-
Speak.new(:language => 'en-US').should_not == Speak.new(:language => 'en-GB')
|
62
|
+
Speak.new(doc, :language => 'en-US').should_not == Speak.new(doc, :language => 'en-GB')
|
59
63
|
end
|
60
64
|
end
|
61
65
|
|
62
66
|
describe "when the base URI is different" do
|
63
67
|
it "should not be equal" do
|
64
|
-
Speak.new(:base_uri => 'foo').should_not == Speak.new(:base_uri => 'bar')
|
68
|
+
Speak.new(doc, :base_uri => 'foo').should_not == Speak.new(doc, :base_uri => 'bar')
|
65
69
|
end
|
66
70
|
end
|
67
71
|
|
68
72
|
describe "when the children are different" do
|
69
73
|
it "should not be equal" do
|
70
|
-
s1 = Speak.new
|
71
|
-
s1 << SayAs.new(:interpret_as => 'date')
|
72
|
-
s2 = Speak.new
|
73
|
-
s2 << SayAs.new(:interpret_as => 'time')
|
74
|
+
s1 = Speak.new doc
|
75
|
+
s1 << SayAs.new(doc, :interpret_as => 'date')
|
76
|
+
s2 = Speak.new doc
|
77
|
+
s2 << SayAs.new(doc, :interpret_as => 'time')
|
74
78
|
|
75
79
|
s1.should_not == s2
|
76
80
|
end
|
@@ -78,10 +82,10 @@ module RubySpeech
|
|
78
82
|
end
|
79
83
|
|
80
84
|
it "should allow creating child SSML elements" do
|
81
|
-
s = Speak.new
|
85
|
+
s = Speak.new doc
|
82
86
|
s.voice :gender => :male, :content => 'Hello'
|
83
|
-
expected_s = Speak.new
|
84
|
-
expected_s << Voice.new(:gender => :male, :content => 'Hello')
|
87
|
+
expected_s = Speak.new doc
|
88
|
+
expected_s << Voice.new(doc, :gender => :male, :content => 'Hello')
|
85
89
|
s.should == expected_s
|
86
90
|
end
|
87
91
|
|
@@ -91,47 +95,47 @@ module RubySpeech
|
|
91
95
|
end
|
92
96
|
|
93
97
|
it "should accept Audio" do
|
94
|
-
lambda { subject << Audio.new }.should_not raise_error
|
98
|
+
lambda { subject << Audio.new(doc) }.should_not raise_error
|
95
99
|
end
|
96
100
|
|
97
101
|
it "should accept Break" do
|
98
|
-
lambda { subject << Break.new }.should_not raise_error
|
102
|
+
lambda { subject << Break.new(doc) }.should_not raise_error
|
99
103
|
end
|
100
104
|
|
101
105
|
it "should accept Emphasis" do
|
102
|
-
lambda { subject << Emphasis.new }.should_not raise_error
|
106
|
+
lambda { subject << Emphasis.new(doc) }.should_not raise_error
|
103
107
|
end
|
104
108
|
|
105
109
|
it "should accept Mark" do
|
106
|
-
lambda { subject << Mark.new }.should_not raise_error
|
110
|
+
lambda { subject << Mark.new(doc) }.should_not raise_error
|
107
111
|
end
|
108
112
|
|
109
113
|
it "should accept P" do
|
110
|
-
lambda { subject << P.new }.should_not raise_error
|
114
|
+
lambda { subject << P.new(doc) }.should_not raise_error
|
111
115
|
end
|
112
116
|
|
113
117
|
it "should accept Phoneme" do
|
114
|
-
lambda { subject << Phoneme.new }.should_not raise_error
|
118
|
+
lambda { subject << Phoneme.new(doc) }.should_not raise_error
|
115
119
|
end
|
116
120
|
|
117
121
|
it "should accept Prosody" do
|
118
|
-
lambda { subject << Prosody.new }.should_not raise_error
|
122
|
+
lambda { subject << Prosody.new(doc) }.should_not raise_error
|
119
123
|
end
|
120
124
|
|
121
125
|
it "should accept SayAs" do
|
122
|
-
lambda { subject << SayAs.new(:interpret_as => :foo) }.should_not raise_error
|
126
|
+
lambda { subject << SayAs.new(doc, :interpret_as => :foo) }.should_not raise_error
|
123
127
|
end
|
124
128
|
|
125
129
|
it "should accept Sub" do
|
126
|
-
lambda { subject << Sub.new }.should_not raise_error
|
130
|
+
lambda { subject << Sub.new(doc) }.should_not raise_error
|
127
131
|
end
|
128
132
|
|
129
133
|
it "should accept S" do
|
130
|
-
lambda { subject << S.new }.should_not raise_error
|
134
|
+
lambda { subject << S.new(doc) }.should_not raise_error
|
131
135
|
end
|
132
136
|
|
133
137
|
it "should accept Voice" do
|
134
|
-
lambda { subject << Voice.new }.should_not raise_error
|
138
|
+
lambda { subject << Voice.new(doc) }.should_not raise_error
|
135
139
|
end
|
136
140
|
|
137
141
|
it "should raise InvalidChildError with non-acceptable objects" do
|
@@ -146,19 +150,31 @@ module RubySpeech
|
|
146
150
|
end
|
147
151
|
|
148
152
|
it "should allow concatenation" do
|
149
|
-
speak1 =
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
153
|
+
speak1 = SSML.draw do
|
154
|
+
voice :name => 'frank' do
|
155
|
+
"Hi, I'm Frank"
|
156
|
+
end
|
157
|
+
end
|
158
|
+
speak2 = SSML.draw do
|
159
|
+
string "Hello there"
|
160
|
+
voice :name => 'millie' do
|
161
|
+
"Hi, I'm Millie"
|
162
|
+
end
|
163
|
+
end
|
154
164
|
|
155
|
-
expected_concat =
|
156
|
-
|
157
|
-
|
158
|
-
|
165
|
+
expected_concat = SSML.draw do
|
166
|
+
voice :name => 'frank' do
|
167
|
+
"Hi, I'm Frank"
|
168
|
+
end
|
169
|
+
string "Hello there"
|
170
|
+
voice :name => 'millie' do
|
171
|
+
"Hi, I'm Millie"
|
172
|
+
end
|
173
|
+
end
|
159
174
|
|
160
175
|
concat = (speak1 + speak2)
|
161
176
|
concat.should == expected_concat
|
177
|
+
concat.document.root.should == concat
|
162
178
|
concat.to_s.should_not include('default')
|
163
179
|
end
|
164
180
|
end # Speak
|
@@ -3,10 +3,14 @@ require 'spec_helper'
|
|
3
3
|
module RubySpeech
|
4
4
|
module SSML
|
5
5
|
describe Sub do
|
6
|
+
let(:doc) { Nokogiri::XML::Document.new }
|
7
|
+
|
8
|
+
subject { described_class.new doc }
|
9
|
+
|
6
10
|
its(:name) { should == 'sub' }
|
7
11
|
|
8
12
|
describe "setting options in initializers" do
|
9
|
-
subject { Sub.new :alias => 'foo' }
|
13
|
+
subject { Sub.new doc, :alias => 'foo' }
|
10
14
|
|
11
15
|
its(:alias) { should == 'foo' }
|
12
16
|
end
|
@@ -27,18 +31,18 @@ module RubySpeech
|
|
27
31
|
|
28
32
|
describe "comparing objects" do
|
29
33
|
it "should be equal if the content and alias are the same" do
|
30
|
-
Sub.new(:alias => 'jp', :content => "Hello there").should == Sub.new(:alias => 'jp', :content => "Hello there")
|
34
|
+
Sub.new(doc, :alias => 'jp', :content => "Hello there").should == Sub.new(doc, :alias => 'jp', :content => "Hello there")
|
31
35
|
end
|
32
36
|
|
33
37
|
describe "when the content is different" do
|
34
38
|
it "should not be equal" do
|
35
|
-
Sub.new(:content => "Hello").should_not == Sub.new(:content => "Hello there")
|
39
|
+
Sub.new(doc, :content => "Hello").should_not == Sub.new(doc, :content => "Hello there")
|
36
40
|
end
|
37
41
|
end
|
38
42
|
|
39
43
|
describe "when the alias is different" do
|
40
44
|
it "should not be equal" do
|
41
|
-
Sub.new(:alias => 'jp').should_not == Sub.new(:alias => 'en')
|
45
|
+
Sub.new(doc, :alias => 'jp').should_not == Sub.new(doc, :alias => 'en')
|
42
46
|
end
|
43
47
|
end
|
44
48
|
end
|
@@ -49,7 +53,7 @@ module RubySpeech
|
|
49
53
|
end
|
50
54
|
|
51
55
|
it "should raise InvalidChildError with non-acceptable objects" do
|
52
|
-
lambda { subject << Voice.new }.should raise_error(InvalidChildError, "A Sub can only accept Strings as children")
|
56
|
+
lambda { subject << Voice.new(doc) }.should raise_error(InvalidChildError, "A Sub can only accept Strings as children")
|
53
57
|
end
|
54
58
|
end
|
55
59
|
end # Desc
|
@@ -3,11 +3,15 @@ require 'spec_helper'
|
|
3
3
|
module RubySpeech
|
4
4
|
module SSML
|
5
5
|
describe Voice do
|
6
|
+
let(:doc) { Nokogiri::XML::Document.new }
|
7
|
+
|
8
|
+
subject { described_class.new doc }
|
9
|
+
|
6
10
|
its(:node_name) { should == 'voice' }
|
7
11
|
its(:name) { should be_nil }
|
8
12
|
|
9
13
|
describe "setting options in initializers" do
|
10
|
-
subject { Voice.new :language => 'jp', :gender => :male, :age => 25, :variant => 2, :name => "paul" }
|
14
|
+
subject { Voice.new doc, :language => 'jp', :gender => :male, :age => 25, :variant => 2, :name => "paul" }
|
11
15
|
|
12
16
|
its(:language) { should == 'jp' }
|
13
17
|
its(:gender) { should == :male }
|
@@ -102,42 +106,42 @@ module RubySpeech
|
|
102
106
|
|
103
107
|
describe "comparing objects" do
|
104
108
|
it "should be equal if the content, language, gender, age, variant, name are the same" do
|
105
|
-
Voice.new(:language => 'jp', :gender => :male, :age => 25, :variant => 2, :name => "paul", :content => "hello").should == Voice.new(:language => 'jp', :gender => :male, :age => 25, :variant => 2, :name => "paul", :content => "hello")
|
109
|
+
Voice.new(doc, :language => 'jp', :gender => :male, :age => 25, :variant => 2, :name => "paul", :content => "hello").should == Voice.new(doc, :language => 'jp', :gender => :male, :age => 25, :variant => 2, :name => "paul", :content => "hello")
|
106
110
|
end
|
107
111
|
|
108
112
|
describe "when the content is different" do
|
109
113
|
it "should not be equal" do
|
110
|
-
Voice.new(:content => "Hello").should_not == Voice.new(:content => "Hello there")
|
114
|
+
Voice.new(doc, :content => "Hello").should_not == Voice.new(doc, :content => "Hello there")
|
111
115
|
end
|
112
116
|
end
|
113
117
|
|
114
118
|
describe "when the language is different" do
|
115
119
|
it "should not be equal" do
|
116
|
-
Voice.new(:language => "Hello").should_not == Voice.new(:language => "Hello there")
|
120
|
+
Voice.new(doc, :language => "Hello").should_not == Voice.new(doc, :language => "Hello there")
|
117
121
|
end
|
118
122
|
end
|
119
123
|
|
120
124
|
describe "when the gender is different" do
|
121
125
|
it "should not be equal" do
|
122
|
-
Voice.new(:gender => :male).should_not == Voice.new(:gender => :female)
|
126
|
+
Voice.new(doc, :gender => :male).should_not == Voice.new(doc, :gender => :female)
|
123
127
|
end
|
124
128
|
end
|
125
129
|
|
126
130
|
describe "when the age is different" do
|
127
131
|
it "should not be equal" do
|
128
|
-
Voice.new(:age => 20).should_not == Voice.new(:age => 30)
|
132
|
+
Voice.new(doc, :age => 20).should_not == Voice.new(doc, :age => 30)
|
129
133
|
end
|
130
134
|
end
|
131
135
|
|
132
136
|
describe "when the variant is different" do
|
133
137
|
it "should not be equal" do
|
134
|
-
Voice.new(:variant => 1).should_not == Voice.new(:variant => 2)
|
138
|
+
Voice.new(doc, :variant => 1).should_not == Voice.new(doc, :variant => 2)
|
135
139
|
end
|
136
140
|
end
|
137
141
|
|
138
142
|
describe "when the name is different" do
|
139
143
|
it "should not be equal" do
|
140
|
-
Voice.new(:name => "Hello").should_not == Voice.new(:name => "Hello there")
|
144
|
+
Voice.new(doc, :name => "Hello").should_not == Voice.new(doc, :name => "Hello there")
|
141
145
|
end
|
142
146
|
end
|
143
147
|
end
|
@@ -148,47 +152,47 @@ module RubySpeech
|
|
148
152
|
end
|
149
153
|
|
150
154
|
it "should accept Audio" do
|
151
|
-
lambda { subject << Audio.new }.should_not raise_error
|
155
|
+
lambda { subject << Audio.new(doc) }.should_not raise_error
|
152
156
|
end
|
153
157
|
|
154
158
|
it "should accept Break" do
|
155
|
-
lambda { subject << Break.new }.should_not raise_error
|
159
|
+
lambda { subject << Break.new(doc) }.should_not raise_error
|
156
160
|
end
|
157
161
|
|
158
162
|
it "should accept Emphasis" do
|
159
|
-
lambda { subject << Emphasis.new }.should_not raise_error
|
163
|
+
lambda { subject << Emphasis.new(doc) }.should_not raise_error
|
160
164
|
end
|
161
165
|
|
162
166
|
it "should accept Mark" do
|
163
|
-
lambda { subject << Mark.new }.should_not raise_error
|
167
|
+
lambda { subject << Mark.new(doc) }.should_not raise_error
|
164
168
|
end
|
165
169
|
|
166
170
|
it "should accept P" do
|
167
|
-
lambda { subject << P.new }.should_not raise_error
|
171
|
+
lambda { subject << P.new(doc) }.should_not raise_error
|
168
172
|
end
|
169
173
|
|
170
174
|
it "should accept Phoneme" do
|
171
|
-
lambda { subject << Phoneme.new }.should_not raise_error
|
175
|
+
lambda { subject << Phoneme.new(doc) }.should_not raise_error
|
172
176
|
end
|
173
177
|
|
174
178
|
it "should accept Prosody" do
|
175
|
-
lambda { subject << Prosody.new }.should_not raise_error
|
179
|
+
lambda { subject << Prosody.new(doc) }.should_not raise_error
|
176
180
|
end
|
177
181
|
|
178
182
|
it "should accept SayAs" do
|
179
|
-
lambda { subject << SayAs.new(:interpret_as => :foo) }.should_not raise_error
|
183
|
+
lambda { subject << SayAs.new(doc, :interpret_as => :foo) }.should_not raise_error
|
180
184
|
end
|
181
185
|
|
182
186
|
it "should accept Sub" do
|
183
|
-
lambda { subject << Sub.new }.should_not raise_error
|
187
|
+
lambda { subject << Sub.new(doc) }.should_not raise_error
|
184
188
|
end
|
185
189
|
|
186
190
|
it "should accept S" do
|
187
|
-
lambda { subject << S.new }.should_not raise_error
|
191
|
+
lambda { subject << S.new(doc) }.should_not raise_error
|
188
192
|
end
|
189
193
|
|
190
194
|
it "should accept Voice" do
|
191
|
-
lambda { subject << Voice.new }.should_not raise_error
|
195
|
+
lambda { subject << Voice.new(doc) }.should_not raise_error
|
192
196
|
end
|
193
197
|
|
194
198
|
it "should raise InvalidChildError with non-acceptable objects" do
|