ruby_speech 2.3.1-java → 3.0.1-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -0
  3. data/.hound.yml +2 -0
  4. data/.travis.yml +25 -9
  5. data/CHANGELOG.md +19 -1
  6. data/README.md +14 -15
  7. data/Rakefile +2 -0
  8. data/ext/ruby_speech/RubySpeechGRXMLMatcher.java +17 -12
  9. data/ext/ruby_speech/RubySpeechService.java +1 -1
  10. data/ext/ruby_speech/extconf.rb +1 -1
  11. data/lib/ruby_speech/generic_element.rb +2 -2
  12. data/lib/ruby_speech/grxml/builtins.rb +18 -11
  13. data/lib/ruby_speech/grxml/grammar.rb +26 -4
  14. data/lib/ruby_speech/grxml/matcher.rb +2 -2
  15. data/lib/ruby_speech/grxml.rb +2 -0
  16. data/lib/ruby_speech/nlsml/builder.rb +2 -1
  17. data/lib/ruby_speech/nlsml/document.rb +5 -0
  18. data/lib/ruby_speech/ruby_speech.jar +0 -0
  19. data/lib/ruby_speech/ssml/break.rb +1 -2
  20. data/lib/ruby_speech/ssml/element.rb +13 -1
  21. data/lib/ruby_speech/ssml/mark.rb +0 -1
  22. data/lib/ruby_speech/ssml/prosody.rb +8 -5
  23. data/lib/ruby_speech/version.rb +1 -1
  24. data/ruby_speech.gemspec +13 -8
  25. data/spec/ruby_speech/grxml/builtins_spec.rb +80 -71
  26. data/spec/ruby_speech/grxml/grammar_spec.rb +168 -34
  27. data/spec/ruby_speech/grxml/item_spec.rb +33 -33
  28. data/spec/ruby_speech/grxml/match_spec.rb +1 -1
  29. data/spec/ruby_speech/grxml/matcher_spec.rb +103 -59
  30. data/spec/ruby_speech/grxml/max_match_spec.rb +2 -2
  31. data/spec/ruby_speech/grxml/no_match_spec.rb +2 -2
  32. data/spec/ruby_speech/grxml/one_of_spec.rb +6 -6
  33. data/spec/ruby_speech/grxml/potential_match_spec.rb +2 -2
  34. data/spec/ruby_speech/grxml/rule_spec.rb +17 -17
  35. data/spec/ruby_speech/grxml/ruleref_spec.rb +10 -10
  36. data/spec/ruby_speech/grxml/tag_spec.rb +5 -5
  37. data/spec/ruby_speech/grxml/token_spec.rb +7 -7
  38. data/spec/ruby_speech/grxml_spec.rb +25 -25
  39. data/spec/ruby_speech/nlsml_spec.rb +58 -10
  40. data/spec/ruby_speech/ssml/audio_spec.rb +19 -19
  41. data/spec/ruby_speech/ssml/break_spec.rb +42 -22
  42. data/spec/ruby_speech/ssml/desc_spec.rb +7 -7
  43. data/spec/ruby_speech/ssml/emphasis_spec.rb +21 -21
  44. data/spec/ruby_speech/ssml/mark_spec.rb +5 -5
  45. data/spec/ruby_speech/ssml/p_spec.rb +17 -17
  46. data/spec/ruby_speech/ssml/phoneme_spec.rb +8 -8
  47. data/spec/ruby_speech/ssml/prosody_spec.rb +82 -64
  48. data/spec/ruby_speech/ssml/s_spec.rb +16 -16
  49. data/spec/ruby_speech/ssml/say_as_spec.rb +9 -9
  50. data/spec/ruby_speech/ssml/speak_spec.rb +29 -29
  51. data/spec/ruby_speech/ssml/sub_spec.rb +7 -7
  52. data/spec/ruby_speech/ssml/voice_spec.rb +31 -31
  53. data/spec/ruby_speech/ssml_spec.rb +41 -17
  54. data/spec/ruby_speech_spec.rb +3 -3
  55. data/spec/spec_helper.rb +8 -3
  56. data/spec/support/dtmf_helper.rb +14 -0
  57. data/spec/support/grammar_matchers.rb +6 -6
  58. data/spec/support/match_examples.rb +5 -5
  59. data/spec/support/matchers.rb +1 -1
  60. metadata +109 -80
@@ -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,18 +17,32 @@ 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
24
- let(:document) { '<break strength="strong" time="3"/>' }
25
-
26
24
  subject { Element.import document }
27
25
 
28
- it { should be_instance_of Break }
26
+ context 'with time of 3' do
27
+ let(:document) { '<break strength="strong" time="3"/>' }
29
28
 
30
- its(:strength) { should == :strong }
31
- its(:time) { should == 3 }
29
+ it { is_expected.to be_instance_of Break }
30
+
31
+ its(:strength) { should == :strong }
32
+ its(:time) { should eql 3.0 }
33
+ end
34
+
35
+ context 'with time of 4s' do
36
+ let(:document) { '<break time="4s"/>' }
37
+
38
+ its(:time) { should eql 4.0 }
39
+ end
40
+
41
+ context 'with time of 5555ms' do
42
+ let(:document) { '<break time="5555ms"/>' }
43
+
44
+ its(:time) { should eql 5.555 }
45
+ end
32
46
  end
33
47
 
34
48
  describe "#strength" do
@@ -37,65 +51,71 @@ module RubySpeech
37
51
  its(:strength) { should == :strong }
38
52
 
39
53
  it "with a valid level" do
40
- lambda { subject.strength = :none }.should_not raise_error
41
- lambda { subject.strength = :'x-weak' }.should_not raise_error
42
- lambda { subject.strength = :weak }.should_not raise_error
43
- lambda { subject.strength = :medium }.should_not raise_error
44
- lambda { subject.strength = :strong }.should_not raise_error
45
- 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
46
60
  end
47
61
 
48
62
  it "with an invalid strength" do
49
- 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\")")
50
64
  end
51
65
  end
52
66
 
53
67
  describe "#time" do
54
- context "with a valid value" do
68
+ context "with a valid whole seconds value of 3" do
55
69
  before { subject.time = 3 }
56
70
 
57
- its(:time) { should == 3 }
71
+ its(:time) { should eql 3.0 }
72
+ end
73
+
74
+ context "with a valid fractional seconds value of 3.5" do
75
+ before { subject.time = 3.5 }
76
+
77
+ its(:time) { should eql 3.5 }
58
78
  end
59
79
 
60
80
  context "with a negative value" do
61
81
  it do
62
- 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)")
63
83
  end
64
84
  end
65
85
 
66
86
  context "with an invalid value" do
67
87
  it do
68
- 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)")
69
89
  end
70
90
  end
71
91
  end
72
92
 
73
93
  describe "<<" do
74
94
  it "should always raise InvalidChildError" do
75
- 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")
76
96
  end
77
97
  end
78
98
 
79
99
  describe "comparing objects" do
80
100
  it "should be equal if the content, strength and base uri are the same" do
81
- 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"))
82
102
  end
83
103
 
84
104
  describe "when the content is different" do
85
105
  it "should not be equal" do
86
- 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"))
87
107
  end
88
108
  end
89
109
 
90
110
  describe "when the strength is different" do
91
111
  it "should not be equal" do
92
- 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))
93
113
  end
94
114
  end
95
115
 
96
116
  describe "when the time is different" do
97
117
  it "should not be equal" do
98
- 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))
99
119
  end
100
120
  end
101
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
@@ -16,7 +16,7 @@ module RubySpeech
16
16
  end
17
17
 
18
18
  it 'registers itself' do
19
- Element.class_from_registration(:mark).should == Mark
19
+ expect(Element.class_from_registration(:mark)).to eq(Mark)
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 Mark }
27
+ it { is_expected.to be_instance_of Mark }
28
28
 
29
29
  its(:name) { should == 'foo' }
30
30
  end
@@ -37,18 +37,18 @@ module RubySpeech
37
37
 
38
38
  describe "<<" do
39
39
  it "should always raise InvalidChildError" do
40
- lambda { subject << 'anything' }.should raise_error(InvalidChildError, "A Mark cannot contain children")
40
+ expect { subject << 'anything' }.to raise_error(InvalidChildError, "A Mark cannot contain children")
41
41
  end
42
42
  end
43
43
 
44
44
  describe "comparing objects" do
45
45
  it "should be equal if the name is the same" do
46
- Mark.new(doc, :name => "foo").should == Mark.new(doc, :name => "foo")
46
+ expect(Mark.new(doc, :name => "foo")).to eq(Mark.new(doc, :name => "foo"))
47
47
  end
48
48
 
49
49
  describe "when the name is different" do
50
50
  it "should not be equal" do
51
- Mark.new(doc, :name => "foo").should_not == Mark.new(doc, :name => "bar")
51
+ expect(Mark.new(doc, :name => "foo")).not_to eq(Mark.new(doc, :name => "bar"))
52
52
  end
53
53
  end
54
54
  end
@@ -16,7 +16,7 @@ module RubySpeech
16
16
  end
17
17
 
18
18
  it 'registers itself' do
19
- Element.class_from_registration(:p).should == P
19
+ expect(Element.class_from_registration(:p)).to eq(P)
20
20
  end
21
21
 
22
22
  describe "from a document" do
@@ -24,75 +24,75 @@ module RubySpeech
24
24
 
25
25
  subject { Element.import document }
26
26
 
27
- it { should be_instance_of P }
27
+ it { is_expected.to be_instance_of P }
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
- P.new(doc, :language => 'jp', :content => "Hello there").should == P.new(doc, :language => 'jp', :content => "Hello there")
33
+ expect(P.new(doc, :language => 'jp', :content => "Hello there")).to eq(P.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
- P.new(doc, :content => "Hello").should_not == P.new(doc, :content => "Hello there")
38
+ expect(P.new(doc, :content => "Hello")).not_to eq(P.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
- P.new(doc, :language => 'jp').should_not == P.new(doc, :language => 'en')
44
+ expect(P.new(doc, :language => 'jp')).not_to eq(P.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
- lambda { subject << 'anything' }.should_not raise_error
51
+ expect { subject << 'anything' }.not_to raise_error
52
52
  end
53
53
 
54
54
  it "should accept Audio" do
55
- lambda { subject << Audio.new(doc) }.should_not raise_error
55
+ expect { subject << Audio.new(doc) }.not_to raise_error
56
56
  end
57
57
 
58
58
  it "should accept Break" do
59
- lambda { subject << Break.new(doc) }.should_not raise_error
59
+ expect { subject << Break.new(doc) }.not_to raise_error
60
60
  end
61
61
 
62
62
  it "should accept Emphasis" do
63
- lambda { subject << Emphasis.new(doc) }.should_not raise_error
63
+ expect { subject << Emphasis.new(doc) }.not_to raise_error
64
64
  end
65
65
 
66
66
  it "should accept Mark" do
67
- lambda { subject << Mark.new(doc) }.should_not raise_error
67
+ expect { subject << Mark.new(doc) }.not_to raise_error
68
68
  end
69
69
 
70
70
  it "should accept Phoneme" do
71
- lambda { subject << Phoneme.new(doc) }.should_not raise_error
71
+ expect { subject << Phoneme.new(doc) }.not_to raise_error
72
72
  end
73
73
 
74
74
  it "should accept Prosody" do
75
- lambda { subject << Prosody.new(doc) }.should_not raise_error
75
+ expect { subject << Prosody.new(doc) }.not_to raise_error
76
76
  end
77
77
 
78
78
  it "should accept SayAs" do
79
- lambda { subject << SayAs.new(doc, :interpret_as => :foo) }.should_not raise_error
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
- lambda { subject << Sub.new(doc) }.should_not raise_error
83
+ expect { subject << Sub.new(doc) }.not_to raise_error
84
84
  end
85
85
 
86
86
  it "should accept S" do
87
- lambda { subject << S.new(doc) }.should_not raise_error
87
+ expect { subject << S.new(doc) }.not_to raise_error
88
88
  end
89
89
 
90
90
  it "should accept Voice" do
91
- lambda { subject << Voice.new(doc) }.should_not raise_error
91
+ expect { subject << Voice.new(doc) }.not_to raise_error
92
92
  end
93
93
 
94
94
  it "should raise InvalidChildError with non-acceptable objects" do
95
- lambda { subject << 1 }.should raise_error(InvalidChildError, "A P can only accept String, Audio, Break, Emphasis, Mark, Phoneme, Prosody, SayAs, Sub, S, Voice as children")
95
+ expect { subject << 1 }.to raise_error(InvalidChildError, "A P can only accept String, Audio, Break, Emphasis, Mark, Phoneme, Prosody, SayAs, Sub, S, Voice as children")
96
96
  end
97
97
  end
98
98
  end # P
@@ -17,7 +17,7 @@ module RubySpeech
17
17
  end
18
18
 
19
19
  it 'registers itself' do
20
- Element.class_from_registration(:phoneme).should == Phoneme
20
+ expect(Element.class_from_registration(:phoneme)).to eq(Phoneme)
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 Phoneme }
28
+ it { is_expected.to be_instance_of Phoneme }
29
29
 
30
30
  its(:alphabet) { should == 'foo' }
31
31
  its(:ph) { should == 'bar' }
@@ -33,35 +33,35 @@ module RubySpeech
33
33
 
34
34
  describe "comparing objects" do
35
35
  it "should be equal if the content, ph and alphabet are the same" do
36
- Phoneme.new(doc, :alphabet => 'jp', :ph => 'foo', :content => "Hello there").should == Phoneme.new(doc, :alphabet => 'jp', :ph => 'foo', :content => "Hello there")
36
+ expect(Phoneme.new(doc, :alphabet => 'jp', :ph => 'foo', :content => "Hello there")).to eq(Phoneme.new(doc, :alphabet => 'jp', :ph => 'foo', :content => "Hello there"))
37
37
  end
38
38
 
39
39
  describe "when the content is different" do
40
40
  it "should not be equal" do
41
- Phoneme.new(doc, :content => "Hello").should_not == Phoneme.new(doc, :content => "Hello there")
41
+ expect(Phoneme.new(doc, :content => "Hello")).not_to eq(Phoneme.new(doc, :content => "Hello there"))
42
42
  end
43
43
  end
44
44
 
45
45
  describe "when the ph is different" do
46
46
  it "should not be equal" do
47
- Phoneme.new(doc, :ph => 'jp').should_not == Phoneme.new(doc, :ph => 'en')
47
+ expect(Phoneme.new(doc, :ph => 'jp')).not_to eq(Phoneme.new(doc, :ph => 'en'))
48
48
  end
49
49
  end
50
50
 
51
51
  describe "when the alphabet is different" do
52
52
  it "should not be equal" do
53
- Phoneme.new(doc, :alphabet => 'jp').should_not == Phoneme.new(doc, :alphabet => 'en')
53
+ expect(Phoneme.new(doc, :alphabet => 'jp')).not_to eq(Phoneme.new(doc, :alphabet => 'en'))
54
54
  end
55
55
  end
56
56
  end
57
57
 
58
58
  describe "<<" do
59
59
  it "should accept String" do
60
- lambda { subject << 'anything' }.should_not raise_error
60
+ expect { subject << 'anything' }.not_to raise_error
61
61
  end
62
62
 
63
63
  it "should raise InvalidChildError with non-acceptable objects" do
64
- lambda { subject << Voice.new(doc) }.should raise_error(InvalidChildError, "A Phoneme can only accept Strings as children")
64
+ expect { subject << Voice.new(doc) }.to raise_error(InvalidChildError, "A Phoneme can only accept Strings as children")
65
65
  end
66
66
  end
67
67
  end # Desc