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
@@ -52,7 +52,7 @@ describe RubySpeech::NLSML do
52
52
  end
53
53
  end
54
54
 
55
- document.to_xml.should == expected_document
55
+ expect(document.to_xml).to eq(expected_document)
56
56
  end
57
57
 
58
58
  it "should return a structured/parsed document" do
@@ -68,7 +68,7 @@ describe RubySpeech::NLSML do
68
68
  end
69
69
  end
70
70
 
71
- document.should be_match
71
+ expect(document).to be_match
72
72
  end
73
73
 
74
74
  context "with a string instance" do
@@ -92,7 +92,7 @@ describe RubySpeech::NLSML do
92
92
  end
93
93
  end
94
94
 
95
- document.to_xml.should == expected_document
95
+ expect(document.to_xml).to eq(expected_document)
96
96
  end
97
97
  end
98
98
  end
@@ -106,7 +106,7 @@ describe RubySpeech::NLSML do
106
106
 
107
107
  its(:grammar) { should == 'http://flight' }
108
108
 
109
- it { should be_match }
109
+ it { is_expected.to be_match }
110
110
 
111
111
  let(:expected_best_interpretation) do
112
112
  {
@@ -133,11 +133,11 @@ describe RubySpeech::NLSML do
133
133
  its(:best_interpretation) { should == expected_best_interpretation }
134
134
 
135
135
  it "should be equal if the XML is the same" do
136
- subject.should be == RubySpeech.parse(example_document)
136
+ expect(subject).to eq(RubySpeech.parse(example_document))
137
137
  end
138
138
 
139
139
  it "should not be equal if the XML is different" do
140
- subject.should_not be == RubySpeech.parse(empty_result)
140
+ expect(subject).not_to eq(RubySpeech.parse(empty_result))
141
141
  end
142
142
 
143
143
  context "when the XML is already parsed and is not the root of a document" do
@@ -280,7 +280,7 @@ describe RubySpeech::NLSML do
280
280
  RubySpeech.parse empty_result
281
281
  end
282
282
 
283
- it { should_not be_match }
283
+ it { is_expected.not_to be_match }
284
284
  end
285
285
 
286
286
  context "with interpretations out of confidence order" do
@@ -389,7 +389,7 @@ describe RubySpeech::NLSML do
389
389
  '''
390
390
  end
391
391
 
392
- it { should_not be_match }
392
+ it { is_expected.not_to be_match }
393
393
  end
394
394
 
395
395
  context "with multiple interpretations where one is a nomatch input" do
@@ -413,7 +413,7 @@ describe RubySpeech::NLSML do
413
413
  '''
414
414
  end
415
415
 
416
- it { should be_match }
416
+ it { is_expected.to be_match }
417
417
  end
418
418
 
419
419
  context "with a single interpretation with a noinput" do
@@ -429,8 +429,8 @@ describe RubySpeech::NLSML do
429
429
  '''
430
430
  end
431
431
 
432
- it { should_not be_match }
433
- it { should be_noinput }
432
+ it { is_expected.not_to be_match }
433
+ it { is_expected.to be_noinput }
434
434
  end
435
435
  end
436
436
  end
@@ -17,7 +17,7 @@ module RubySpeech
17
17
  end
18
18
 
19
19
  it 'registers itself' do
20
- Element.class_from_registration(:audio).should == Audio
20
+ expect(Element.class_from_registration(:audio)).to eq(Audio)
21
21
  end
22
22
 
23
23
  describe "from a document" do
@@ -25,7 +25,7 @@ module RubySpeech
25
25
 
26
26
  subject { Element.import document }
27
27
 
28
- it { should be_instance_of Audio }
28
+ it { is_expected.to be_instance_of Audio }
29
29
 
30
30
  its(:src) { should == 'http://whatever.you-say-boss.com' }
31
31
  its(:content) { should == 'Hello' }
@@ -47,76 +47,76 @@ module RubySpeech
47
47
 
48
48
  describe "<<" do
49
49
  it "should accept String" do
50
- lambda { subject << 'anything' }.should_not raise_error
50
+ expect { subject << 'anything' }.not_to raise_error
51
51
  end
52
52
 
53
53
  it "should accept Audio" do
54
- lambda { subject << Audio.new(doc) }.should_not raise_error
54
+ expect { subject << Audio.new(doc) }.not_to raise_error
55
55
  end
56
56
 
57
57
  it "should accept Break" do
58
- lambda { subject << Break.new(doc) }.should_not raise_error
58
+ expect { subject << Break.new(doc) }.not_to raise_error
59
59
  end
60
60
 
61
61
  it "should accept Desc" do
62
- lambda { subject << Desc.new(doc) }.should_not raise_error
62
+ expect { subject << Desc.new(doc) }.not_to raise_error
63
63
  end
64
64
 
65
65
  it "should accept Emphasis" do
66
- lambda { subject << Emphasis.new(doc) }.should_not raise_error
66
+ expect { subject << Emphasis.new(doc) }.not_to raise_error
67
67
  end
68
68
 
69
69
  it "should accept Mark" do
70
- lambda { subject << Mark.new(doc) }.should_not raise_error
70
+ expect { subject << Mark.new(doc) }.not_to raise_error
71
71
  end
72
72
 
73
73
  it "should accept P" do
74
- lambda { subject << P.new(doc) }.should_not raise_error
74
+ expect { subject << P.new(doc) }.not_to raise_error
75
75
  end
76
76
 
77
77
  it "should accept Phoneme" do
78
- lambda { subject << Phoneme.new(doc) }.should_not raise_error
78
+ expect { subject << Phoneme.new(doc) }.not_to raise_error
79
79
  end
80
80
 
81
81
  it "should accept Prosody" do
82
- lambda { subject << Prosody.new(doc) }.should_not raise_error
82
+ expect { subject << Prosody.new(doc) }.not_to raise_error
83
83
  end
84
84
 
85
85
  it "should accept SayAs" do
86
- lambda { subject << SayAs.new(doc, :interpret_as => :foo) }.should_not raise_error
86
+ expect { subject << SayAs.new(doc, :interpret_as => :foo) }.not_to raise_error
87
87
  end
88
88
 
89
89
  it "should accept Sub" do
90
- lambda { subject << Sub.new(doc) }.should_not raise_error
90
+ expect { subject << Sub.new(doc) }.not_to raise_error
91
91
  end
92
92
 
93
93
  it "should accept S" do
94
- lambda { subject << S.new(doc) }.should_not raise_error
94
+ expect { subject << S.new(doc) }.not_to raise_error
95
95
  end
96
96
 
97
97
  it "should accept Voice" do
98
- lambda { subject << Voice.new(doc) }.should_not raise_error
98
+ expect { subject << Voice.new(doc) }.not_to raise_error
99
99
  end
100
100
 
101
101
  it "should raise InvalidChildError with non-acceptable objects" do
102
- lambda { subject << 1 }.should raise_error(InvalidChildError, "An Audio can only accept String, Audio, Break, Emphasis, Mark, P, Phoneme, Prosody, SayAs, Sub, S, Voice as children")
102
+ expect { subject << 1 }.to raise_error(InvalidChildError, "An Audio can only accept String, Audio, Break, Emphasis, Mark, P, Phoneme, Prosody, SayAs, Sub, S, Voice as children")
103
103
  end
104
104
  end
105
105
 
106
106
  describe "comparing objects" do
107
107
  it "should be equal if the content, and src are the same" do
108
- Audio.new(doc, :src => "one", :content => "Hello there").should == Audio.new(doc, :src => "one", :content => "Hello there")
108
+ expect(Audio.new(doc, :src => "one", :content => "Hello there")).to eq(Audio.new(doc, :src => "one", :content => "Hello there"))
109
109
  end
110
110
 
111
111
  describe "when the content is different" do
112
112
  it "should not be equal" do
113
- Audio.new(doc, :content => "Hello").should_not == Audio.new(doc, :content => "Hello there")
113
+ expect(Audio.new(doc, :content => "Hello")).not_to eq(Audio.new(doc, :content => "Hello there"))
114
114
  end
115
115
  end
116
116
 
117
117
  describe "when the src is different" do
118
118
  it "should not be equal" do
119
- Audio.new(doc, :src => 'one').should_not == Audio.new(doc, :src => 'two')
119
+ expect(Audio.new(doc, :src => 'one')).not_to eq(Audio.new(doc, :src => 'two'))
120
120
  end
121
121
  end
122
122
  end
@@ -17,7 +17,7 @@ module RubySpeech
17
17
  end
18
18
 
19
19
  it 'registers itself' do
20
- Element.class_from_registration(:break).should == Break
20
+ expect(Element.class_from_registration(:break)).to eq(Break)
21
21
  end
22
22
 
23
23
  describe "from a document" do
@@ -26,7 +26,7 @@ module RubySpeech
26
26
  context 'with time of 3' do
27
27
  let(:document) { '<break strength="strong" time="3"/>' }
28
28
 
29
- it { should be_instance_of Break }
29
+ it { is_expected.to be_instance_of Break }
30
30
 
31
31
  its(:strength) { should == :strong }
32
32
  its(:time) { should eql 3.0 }
@@ -51,16 +51,16 @@ module RubySpeech
51
51
  its(:strength) { should == :strong }
52
52
 
53
53
  it "with a valid level" do
54
- lambda { subject.strength = :none }.should_not raise_error
55
- lambda { subject.strength = :'x-weak' }.should_not raise_error
56
- lambda { subject.strength = :weak }.should_not raise_error
57
- lambda { subject.strength = :medium }.should_not raise_error
58
- lambda { subject.strength = :strong }.should_not raise_error
59
- lambda { subject.strength = :'x-strong' }.should_not raise_error
54
+ expect { subject.strength = :none }.not_to raise_error
55
+ expect { subject.strength = :'x-weak' }.not_to raise_error
56
+ expect { subject.strength = :weak }.not_to raise_error
57
+ expect { subject.strength = :medium }.not_to raise_error
58
+ expect { subject.strength = :strong }.not_to raise_error
59
+ expect { subject.strength = :'x-strong' }.not_to raise_error
60
60
  end
61
61
 
62
62
  it "with an invalid strength" do
63
- lambda { subject.strength = :something }.should raise_error(ArgumentError, "You must specify a valid strength (:none, :\"x-weak\", :weak, :medium, :strong, :\"x-strong\")")
63
+ expect { subject.strength = :something }.to raise_error(ArgumentError, "You must specify a valid strength (:none, :\"x-weak\", :weak, :medium, :strong, :\"x-strong\")")
64
64
  end
65
65
  end
66
66
 
@@ -79,43 +79,43 @@ module RubySpeech
79
79
 
80
80
  context "with a negative value" do
81
81
  it do
82
- lambda { subject.time = -3 }.should raise_error(ArgumentError, "You must specify a valid time (positive float value in seconds)")
82
+ expect { subject.time = -3 }.to raise_error(ArgumentError, "You must specify a valid time (positive float value in seconds)")
83
83
  end
84
84
  end
85
85
 
86
86
  context "with an invalid value" do
87
87
  it do
88
- lambda { subject.time = 'blah' }.should raise_error(ArgumentError, "You must specify a valid time (positive float value in seconds)")
88
+ expect { subject.time = 'blah' }.to raise_error(ArgumentError, "You must specify a valid time (positive float value in seconds)")
89
89
  end
90
90
  end
91
91
  end
92
92
 
93
93
  describe "<<" do
94
94
  it "should always raise InvalidChildError" do
95
- lambda { subject << 'anything' }.should raise_error(InvalidChildError, "A Break cannot contain children")
95
+ expect { subject << 'anything' }.to raise_error(InvalidChildError, "A Break cannot contain children")
96
96
  end
97
97
  end
98
98
 
99
99
  describe "comparing objects" do
100
100
  it "should be equal if the content, strength and base uri are the same" do
101
- Break.new(doc, :strength => :strong, :time => 1, :content => "Hello there").should == Break.new(doc, :strength => :strong, :time => 1, :content => "Hello there")
101
+ expect(Break.new(doc, :strength => :strong, :time => 1, :content => "Hello there")).to eq(Break.new(doc, :strength => :strong, :time => 1, :content => "Hello there"))
102
102
  end
103
103
 
104
104
  describe "when the content is different" do
105
105
  it "should not be equal" do
106
- Break.new(doc, :content => "Hello").should_not == Break.new(doc, :content => "Hello there")
106
+ expect(Break.new(doc, :content => "Hello")).not_to eq(Break.new(doc, :content => "Hello there"))
107
107
  end
108
108
  end
109
109
 
110
110
  describe "when the strength is different" do
111
111
  it "should not be equal" do
112
- Break.new(doc, :strength => :strong).should_not == Break.new(doc, :strength => :weak)
112
+ expect(Break.new(doc, :strength => :strong)).not_to eq(Break.new(doc, :strength => :weak))
113
113
  end
114
114
  end
115
115
 
116
116
  describe "when the time is different" do
117
117
  it "should not be equal" do
118
- Break.new(doc, :time => 1).should_not == Break.new(doc, :time => 2)
118
+ expect(Break.new(doc, :time => 1)).not_to eq(Break.new(doc, :time => 2))
119
119
  end
120
120
  end
121
121
  end
@@ -16,7 +16,7 @@ module RubySpeech
16
16
  end
17
17
 
18
18
  it 'registers itself' do
19
- Element.class_from_registration(:desc).should == Desc
19
+ expect(Element.class_from_registration(:desc)).to eq(Desc)
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 { should be_instance_of Desc }
27
+ it { is_expected.to be_instance_of Desc }
28
28
 
29
29
  its(:language) { should == 'en' }
30
30
  end
31
31
 
32
32
  describe "comparing objects" do
33
33
  it "should be equal if the content and language are the same" do
34
- Desc.new(doc, :language => 'jp', :content => "Hello there").should == Desc.new(doc, :language => 'jp', :content => "Hello there")
34
+ expect(Desc.new(doc, :language => 'jp', :content => "Hello there")).to eq(Desc.new(doc, :language => '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
- Desc.new(doc, :content => "Hello").should_not == Desc.new(doc, :content => "Hello there")
39
+ expect(Desc.new(doc, :content => "Hello")).not_to eq(Desc.new(doc, :content => "Hello there"))
40
40
  end
41
41
  end
42
42
 
43
43
  describe "when the language is different" do
44
44
  it "should not be equal" do
45
- Desc.new(doc, :language => 'jp').should_not == Desc.new(doc, :language => 'en')
45
+ expect(Desc.new(doc, :language => 'jp')).not_to eq(Desc.new(doc, :language => 'en'))
46
46
  end
47
47
  end
48
48
  end
49
49
 
50
50
  describe "<<" do
51
51
  it "should accept String" do
52
- lambda { subject << 'anything' }.should_not raise_error
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
- lambda { subject << Voice.new(doc) }.should raise_error(InvalidChildError, "A Desc can only accept Strings as children")
56
+ expect { subject << Voice.new(doc) }.to raise_error(InvalidChildError, "A Desc can only accept Strings as children")
57
57
  end
58
58
  end
59
59
  end # Desc
@@ -16,7 +16,7 @@ module RubySpeech
16
16
  end
17
17
 
18
18
  it 'registers itself' do
19
- Element.class_from_registration(:emphasis).should == Emphasis
19
+ expect(Element.class_from_registration(:emphasis)).to eq(Emphasis)
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 { should be_instance_of Emphasis }
27
+ it { is_expected.to be_instance_of Emphasis }
28
28
 
29
29
  its(:level) { should == :strong }
30
30
  end
@@ -35,78 +35,78 @@ module RubySpeech
35
35
  its(:level) { should == :strong }
36
36
 
37
37
  it "with a valid level" do
38
- lambda { subject.level = :strong }.should_not raise_error
39
- lambda { subject.level = :moderate }.should_not raise_error
40
- lambda { subject.level = :none }.should_not raise_error
41
- lambda { subject.level = :reduced }.should_not raise_error
38
+ expect { subject.level = :strong }.not_to raise_error
39
+ expect { subject.level = :moderate }.not_to raise_error
40
+ expect { subject.level = :none }.not_to raise_error
41
+ expect { subject.level = :reduced }.not_to raise_error
42
42
  end
43
43
 
44
44
  it "with an invalid level" do
45
- lambda { subject.level = :something }.should raise_error(ArgumentError, "You must specify a valid level (:strong, :moderate, :none, :reduced)")
45
+ expect { subject.level = :something }.to raise_error(ArgumentError, "You must specify a valid level (:strong, :moderate, :none, :reduced)")
46
46
  end
47
47
  end
48
48
 
49
49
  describe "comparing objects" do
50
50
  it "should be equal if the content and level are the same" do
51
- Emphasis.new(doc, :level => :strong, :content => "Hello there").should == Emphasis.new(doc, :level => :strong, :content => "Hello there")
51
+ expect(Emphasis.new(doc, :level => :strong, :content => "Hello there")).to eq(Emphasis.new(doc, :level => :strong, :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
- Emphasis.new(doc, :content => "Hello").should_not == Emphasis.new(doc, :content => "Hello there")
56
+ expect(Emphasis.new(doc, :content => "Hello")).not_to eq(Emphasis.new(doc, :content => "Hello there"))
57
57
  end
58
58
  end
59
59
 
60
60
  describe "when the level is different" do
61
61
  it "should not be equal" do
62
- Emphasis.new(doc, :level => :strong).should_not == Emphasis.new(doc, :level => :reduced)
62
+ expect(Emphasis.new(doc, :level => :strong)).not_to eq(Emphasis.new(doc, :level => :reduced))
63
63
  end
64
64
  end
65
65
  end
66
66
 
67
67
  describe "<<" do
68
68
  it "should accept String" do
69
- lambda { subject << 'anything' }.should_not raise_error
69
+ expect { subject << 'anything' }.not_to raise_error
70
70
  end
71
71
 
72
72
  it "should accept Audio" do
73
- lambda { subject << Audio.new(doc) }.should_not raise_error
73
+ expect { subject << Audio.new(doc) }.not_to raise_error
74
74
  end
75
75
 
76
76
  it "should accept Break" do
77
- lambda { subject << Break.new(doc) }.should_not raise_error
77
+ expect { subject << Break.new(doc) }.not_to raise_error
78
78
  end
79
79
 
80
80
  it "should accept Emphasis" do
81
- lambda { subject << Emphasis.new(doc) }.should_not raise_error
81
+ expect { subject << Emphasis.new(doc) }.not_to raise_error
82
82
  end
83
83
 
84
84
  it "should accept Mark" do
85
- lambda { subject << Mark.new(doc) }.should_not raise_error
85
+ expect { subject << Mark.new(doc) }.not_to raise_error
86
86
  end
87
87
 
88
88
  it "should accept Phoneme" do
89
- lambda { subject << Phoneme.new(doc) }.should_not raise_error
89
+ expect { subject << Phoneme.new(doc) }.not_to raise_error
90
90
  end
91
91
 
92
92
  it "should accept Prosody" do
93
- lambda { subject << Prosody.new(doc) }.should_not raise_error
93
+ expect { subject << Prosody.new(doc) }.not_to raise_error
94
94
  end
95
95
 
96
96
  it "should accept SayAs" do
97
- lambda { subject << SayAs.new(doc, :interpret_as => :foo) }.should_not raise_error
97
+ expect { subject << SayAs.new(doc, :interpret_as => :foo) }.not_to raise_error
98
98
  end
99
99
 
100
100
  it "should accept Sub" do
101
- lambda { subject << Sub.new(doc) }.should_not raise_error
101
+ expect { subject << Sub.new(doc) }.not_to raise_error
102
102
  end
103
103
 
104
104
  it "should accept Voice" do
105
- lambda { subject << Voice.new(doc) }.should_not raise_error
105
+ expect { subject << Voice.new(doc) }.not_to raise_error
106
106
  end
107
107
 
108
108
  it "should raise InvalidChildError with non-acceptable objects" do
109
- lambda { subject << 1 }.should raise_error(InvalidChildError, "An Emphasis can only accept String, Audio, Break, Emphasis, Mark, Phoneme, Prosody, SayAs, Sub, Voice as children")
109
+ expect { subject << 1 }.to raise_error(InvalidChildError, "An Emphasis can only accept String, Audio, Break, Emphasis, Mark, Phoneme, Prosody, SayAs, Sub, Voice as children")
110
110
  end
111
111
  end
112
112
  end # Emphasis