ruby_speech 2.4.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -0
  3. data/.travis.yml +11 -23
  4. data/CHANGELOG.md +4 -0
  5. data/README.md +2 -2
  6. data/Rakefile +2 -0
  7. data/lib/ruby_speech/version.rb +1 -1
  8. data/ruby_speech.gemspec +3 -3
  9. data/spec/ruby_speech/grxml/builtins_spec.rb +72 -72
  10. data/spec/ruby_speech/grxml/grammar_spec.rb +37 -37
  11. data/spec/ruby_speech/grxml/item_spec.rb +33 -33
  12. data/spec/ruby_speech/grxml/match_spec.rb +1 -1
  13. data/spec/ruby_speech/grxml/matcher_spec.rb +62 -62
  14. data/spec/ruby_speech/grxml/max_match_spec.rb +2 -2
  15. data/spec/ruby_speech/grxml/no_match_spec.rb +2 -2
  16. data/spec/ruby_speech/grxml/one_of_spec.rb +6 -6
  17. data/spec/ruby_speech/grxml/potential_match_spec.rb +2 -2
  18. data/spec/ruby_speech/grxml/rule_spec.rb +17 -17
  19. data/spec/ruby_speech/grxml/ruleref_spec.rb +10 -10
  20. data/spec/ruby_speech/grxml/tag_spec.rb +5 -5
  21. data/spec/ruby_speech/grxml/token_spec.rb +7 -7
  22. data/spec/ruby_speech/grxml_spec.rb +24 -24
  23. data/spec/ruby_speech/nlsml_spec.rb +11 -11
  24. data/spec/ruby_speech/ssml/audio_spec.rb +19 -19
  25. data/spec/ruby_speech/ssml/break_spec.rb +16 -16
  26. data/spec/ruby_speech/ssml/desc_spec.rb +7 -7
  27. data/spec/ruby_speech/ssml/emphasis_spec.rb +21 -21
  28. data/spec/ruby_speech/ssml/mark_spec.rb +5 -5
  29. data/spec/ruby_speech/ssml/p_spec.rb +17 -17
  30. data/spec/ruby_speech/ssml/phoneme_spec.rb +8 -8
  31. data/spec/ruby_speech/ssml/prosody_spec.rb +61 -61
  32. data/spec/ruby_speech/ssml/s_spec.rb +16 -16
  33. data/spec/ruby_speech/ssml/say_as_spec.rb +9 -9
  34. data/spec/ruby_speech/ssml/speak_spec.rb +29 -29
  35. data/spec/ruby_speech/ssml/sub_spec.rb +7 -7
  36. data/spec/ruby_speech/ssml/voice_spec.rb +31 -31
  37. data/spec/ruby_speech/ssml_spec.rb +20 -20
  38. data/spec/ruby_speech_spec.rb +3 -3
  39. data/spec/spec_helper.rb +0 -1
  40. data/spec/support/grammar_matchers.rb +6 -6
  41. data/spec/support/match_examples.rb +5 -5
  42. data/spec/support/matchers.rb +1 -1
  43. metadata +17 -11
@@ -7,40 +7,40 @@ module RubySpeech
7
7
 
8
8
  it "should create an SSML document" do
9
9
  expected_doc = SSML::Speak.new doc
10
- SSML.draw.should == expected_doc
11
- SSML.draw.document.xpath('ns:speak', ns: 'http://www.w3.org/2001/10/synthesis').size.should == 1
10
+ expect(SSML.draw).to eq(expected_doc)
11
+ expect(SSML.draw.document.xpath('ns:speak', ns: 'http://www.w3.org/2001/10/synthesis').size).to eq(1)
12
12
  end
13
13
 
14
14
  it "can draw with a language" do
15
15
  expected_doc = SSML::Speak.new doc, language: 'pt-BR'
16
- SSML.draw(language: 'pt-BR').should == expected_doc
16
+ expect(SSML.draw(language: 'pt-BR')).to eq(expected_doc)
17
17
  end
18
18
 
19
19
  describe "when the return value of the block is a string" do
20
20
  it "should be inserted into the document" do
21
21
  expected_doc = SSML::Speak.new(doc, :content => "Hi, I'm Fred")
22
- SSML.draw { "Hi, I'm Fred" }.should == expected_doc
22
+ expect(SSML.draw { "Hi, I'm Fred" }).to eq(expected_doc)
23
23
  end
24
24
  end
25
25
 
26
26
  describe "when the return value of the block is not a string" do
27
27
  it "should not be inserted into the document" do
28
28
  expected_doc = SSML::Speak.new doc
29
- SSML.draw { :foo }.should == expected_doc
29
+ expect(SSML.draw { :foo }).to eq(expected_doc)
30
30
  end
31
31
  end
32
32
 
33
33
  describe "when inserting a string" do
34
34
  it "should work" do
35
35
  expected_doc = SSML::Speak.new(doc, :content => "Hi, I'm Fred")
36
- SSML.draw { string "Hi, I'm Fred" }.should == expected_doc
36
+ expect(SSML.draw { string "Hi, I'm Fred" }).to eq(expected_doc)
37
37
  end
38
38
  end
39
39
 
40
40
  it "should allow other SSML elements to be inserted in the document" do
41
41
  expected_doc = SSML::Speak.new doc
42
42
  expected_doc << SSML::Voice.new(doc, :gender => :male, :name => 'fred')
43
- SSML.draw { voice :gender => :male, :name => 'fred' }.should == expected_doc
43
+ expect(SSML.draw { voice :gender => :male, :name => 'fred' }).to eq(expected_doc)
44
44
  end
45
45
 
46
46
  it "should allow nested block return values" do
@@ -52,7 +52,7 @@ module RubySpeech
52
52
  "Hi, I'm Fred."
53
53
  end
54
54
  end
55
- doc.should == expected_doc
55
+ expect(doc).to eq(expected_doc)
56
56
  end
57
57
 
58
58
  it "should allow nested SSML elements" do
@@ -69,7 +69,7 @@ module RubySpeech
69
69
  voice << SSML::SayAs.new(doc, :interpret_as => 'date', :format => 'dmy', :content => "01/02/1960")
70
70
  expected_doc = SSML::Speak.new doc
71
71
  expected_doc << voice
72
- drawn_doc.should == expected_doc
72
+ expect(drawn_doc).to eq(expected_doc)
73
73
  end
74
74
 
75
75
  it "should allow accessing methods defined outside the block" do
@@ -78,7 +78,7 @@ module RubySpeech
78
78
  end
79
79
 
80
80
  expected_doc = SSML::Speak.new doc, :content => foo
81
- SSML.draw { string foo }.should == expected_doc
81
+ expect(SSML.draw { string foo }).to eq(expected_doc)
82
82
  end
83
83
 
84
84
  describe 'cloning' do
@@ -92,15 +92,15 @@ module RubySpeech
92
92
  subject { original.clone }
93
93
 
94
94
  it 'should match the contents of the original document' do
95
- subject.to_s.should == original.to_s
95
+ expect(subject.to_s).to eq(original.to_s)
96
96
  end
97
97
 
98
98
  it 'should match the class of the original document' do
99
- subject.class.should == original.class
99
+ expect(subject.class).to eq(original.class)
100
100
  end
101
101
 
102
102
  it 'should be equal to the original document' do
103
- subject.should == original
103
+ expect(subject).to eq(original)
104
104
  end
105
105
  end
106
106
  end
@@ -129,7 +129,7 @@ module RubySpeech
129
129
  end
130
130
  end
131
131
 
132
- doc2.should == expected_doc
132
+ expect(doc2).to eq(expected_doc)
133
133
  end
134
134
 
135
135
  it "SSML elements" do
@@ -149,7 +149,7 @@ module RubySpeech
149
149
  end
150
150
  end
151
151
 
152
- doc.should == expected_doc
152
+ expect(doc).to eq(expected_doc)
153
153
  end
154
154
 
155
155
  it "strings" do
@@ -167,7 +167,7 @@ module RubySpeech
167
167
  end
168
168
  end
169
169
 
170
- doc.should == expected_doc
170
+ expect(doc).to eq(expected_doc)
171
171
  end
172
172
  end
173
173
 
@@ -180,7 +180,7 @@ module RubySpeech
180
180
  2.times do
181
181
  expected_doc << SSML::Voice.new(doc, :native_content => "I <3 nachos.")
182
182
  end
183
- drawn_doc.should == expected_doc
183
+ expect(drawn_doc).to eq(expected_doc)
184
184
  end
185
185
 
186
186
  it "should allow all permutations of possible nested SSML elements" do
@@ -270,7 +270,7 @@ module RubySpeech
270
270
  voice << SSML::Prosody.new(doc, :rate => :fast, :content => "And yet so spritely!")
271
271
  voice << SSML::Voice.new(doc, :age => 12, :content => "And I'm young Fred")
272
272
  expected_doc << voice
273
- drawn_doc.should == expected_doc
273
+ expect(drawn_doc).to eq(expected_doc)
274
274
  end
275
275
  end
276
276
 
@@ -293,10 +293,10 @@ module RubySpeech
293
293
  subject { import }
294
294
 
295
295
  it "should work" do
296
- lambda { subject }.should_not raise_error
296
+ expect { subject }.not_to raise_error
297
297
  end
298
298
 
299
- it { should be_a SSML::Speak }
299
+ it { is_expected.to be_a SSML::Speak }
300
300
 
301
301
  its(:children) { should == [voice] }
302
302
 
@@ -30,7 +30,7 @@ describe RubySpeech do
30
30
  '''
31
31
  end
32
32
 
33
- it { should be_a RubySpeech::SSML::Element }
33
+ it { is_expected.to be_a RubySpeech::SSML::Element }
34
34
  end
35
35
 
36
36
  context "with a GRXML document" do
@@ -91,7 +91,7 @@ describe RubySpeech do
91
91
  '''
92
92
  end
93
93
 
94
- it { should be_a RubySpeech::GRXML::Element }
94
+ it { is_expected.to be_a RubySpeech::GRXML::Element }
95
95
  end
96
96
 
97
97
  context "with an NLSML document" do
@@ -118,7 +118,7 @@ describe RubySpeech do
118
118
  '''
119
119
  end
120
120
 
121
- it { should be_a RubySpeech::NLSML::Document }
121
+ it { is_expected.to be_a RubySpeech::NLSML::Document }
122
122
  end
123
123
  end
124
124
  end
@@ -24,5 +24,4 @@ puts "Finished loading schema."
24
24
  RSpec.configure do |config|
25
25
  config.filter_run :focus => true
26
26
  config.run_all_when_everything_filtered = true
27
- config.treat_symbols_as_metadata_keys_with_true_values = true
28
27
  end
@@ -6,7 +6,7 @@ RSpec::Matchers.define :not_match do |input|
6
6
  @result.is_a?(RubySpeech::GRXML::NoMatch)
7
7
  end
8
8
 
9
- failure_message_for_should do |grammar|
9
+ failure_message do |grammar|
10
10
  "expected #{grammar} to not match #{input}, but received a #{@result.class}"
11
11
  end
12
12
  end
@@ -17,7 +17,7 @@ RSpec::Matchers.define :potentially_match do |input|
17
17
  @result.is_a?(RubySpeech::GRXML::PotentialMatch)
18
18
  end
19
19
 
20
- failure_message_for_should do |grammar|
20
+ failure_message do |grammar|
21
21
  "expected #{grammar} to potentially match #{input}, but received a #{@result.class}"
22
22
  end
23
23
  end
@@ -33,10 +33,10 @@ RSpec::Matchers.define :match do |input|
33
33
  end
34
34
 
35
35
  description do
36
- %{#{default_description} and interpret as "#{@interpretation}"}
36
+ %{#{super()} and interpret as "#{@interpretation}"}
37
37
  end
38
38
 
39
- failure_message_for_should do |grammar|
39
+ failure_message do |grammar|
40
40
  messages = []
41
41
  unless @result.is_a?(RubySpeech::GRXML::Match)
42
42
  messages << "expected #{grammar} to match, got a #{@result.class}"
@@ -61,10 +61,10 @@ RSpec::Matchers.define :max_match do |input|
61
61
  end
62
62
 
63
63
  description do
64
- %{#{default_description} and interpret as "#{@interpretation}"}
64
+ %{#{super()} and interpret as "#{@interpretation}"}
65
65
  end
66
66
 
67
- failure_message_for_should do |grammar|
67
+ failure_message do |grammar|
68
68
  messages = []
69
69
  unless @result.is_a?(RubySpeech::GRXML::MaxMatch)
70
70
  messages << "expected #{grammar} to max-match, got a #{@result.class}"
@@ -13,30 +13,30 @@ shared_examples_for "match" do
13
13
 
14
14
  describe "equality" do
15
15
  it "should be equal when mode, confidence, utterance and interpretation are the same" do
16
- described_class.new(:mode => :dtmf, :confidence => 1, :utterance => '6', :interpretation => 'foo').should == described_class.new(:mode => :dtmf, :confidence => 1, :utterance => '6', :interpretation => 'foo')
16
+ expect(described_class.new(:mode => :dtmf, :confidence => 1, :utterance => '6', :interpretation => 'foo')).to eq(described_class.new(:mode => :dtmf, :confidence => 1, :utterance => '6', :interpretation => 'foo'))
17
17
  end
18
18
 
19
19
  describe "when the mode is different" do
20
20
  it "should not be equal" do
21
- described_class.new(:mode => :dtmf).should_not == described_class.new(:mode => :speech)
21
+ expect(described_class.new(:mode => :dtmf)).not_to eq(described_class.new(:mode => :speech))
22
22
  end
23
23
  end
24
24
 
25
25
  describe "when the confidence is different" do
26
26
  it "should not be equal" do
27
- described_class.new(:confidence => 1).should_not == described_class.new(:confidence => 0)
27
+ expect(described_class.new(:confidence => 1)).not_to eq(described_class.new(:confidence => 0))
28
28
  end
29
29
  end
30
30
 
31
31
  describe "when the utterance is different" do
32
32
  it "should not be equal" do
33
- described_class.new(:utterance => '6').should_not == described_class.new(:utterance => 'foo')
33
+ expect(described_class.new(:utterance => '6')).not_to eq(described_class.new(:utterance => 'foo'))
34
34
  end
35
35
  end
36
36
 
37
37
  describe "when the interpretation is different" do
38
38
  it "should not be equal" do
39
- described_class.new(:interpretation => 'foo').should_not == described_class.new(:interpretation => 'bar')
39
+ expect(described_class.new(:interpretation => 'foo')).not_to eq(described_class.new(:interpretation => 'bar'))
40
40
  end
41
41
  end
42
42
  end
@@ -21,7 +21,7 @@ class SpeechDocMatcher
21
21
  " expected #{subject} to be a valid #{type} document\n#{errors}"
22
22
  end
23
23
 
24
- def negative_failure_message
24
+ def failure_message_when_negated
25
25
  " expected #{subject} not to be a valid #{type} document"
26
26
  end
27
27
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_speech
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Langfeld
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-24 00:00:00.000000000 Z
11
+ date: 2018-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -16,14 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.6.0
19
+ version: '1.8'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.8.3
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - "~>"
25
28
  - !ruby/object:Gem::Version
26
- version: 1.6.0
29
+ version: '1.8'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 1.8.3
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: activesupport
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -64,14 +70,14 @@ dependencies:
64
70
  requirements:
65
71
  - - "~>"
66
72
  - !ruby/object:Gem::Version
67
- version: 2.99.0
73
+ version: '3.0'
68
74
  type: :development
69
75
  prerelease: false
70
76
  version_requirements: !ruby/object:Gem::Requirement
71
77
  requirements:
72
78
  - - "~>"
73
79
  - !ruby/object:Gem::Version
74
- version: 2.99.0
80
+ version: '3.0'
75
81
  - !ruby/object:Gem::Dependency
76
82
  name: rspec-its
77
83
  requirement: !ruby/object:Gem::Requirement
@@ -118,16 +124,16 @@ dependencies:
118
124
  name: rake
119
125
  requirement: !ruby/object:Gem::Requirement
120
126
  requirements:
121
- - - "<"
127
+ - - ">="
122
128
  - !ruby/object:Gem::Version
123
- version: '11.0'
129
+ version: '0'
124
130
  type: :development
125
131
  prerelease: false
126
132
  version_requirements: !ruby/object:Gem::Requirement
127
133
  requirements:
128
- - - "<"
134
+ - - ">="
129
135
  - !ruby/object:Gem::Version
130
- version: '11.0'
136
+ version: '0'
131
137
  - !ruby/object:Gem::Dependency
132
138
  name: guard
133
139
  requirement: !ruby/object:Gem::Requirement
@@ -346,7 +352,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
346
352
  version: '0'
347
353
  requirements: []
348
354
  rubyforge_project: ruby_speech
349
- rubygems_version: 2.5.1
355
+ rubygems_version: 2.7.3
350
356
  signing_key:
351
357
  specification_version: 4
352
358
  summary: A Ruby library for TTS & ASR document preparation