rspec-rayo 0.1.15 → 0.1.16
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rspec-rayo/rayo/matchers.rb +5 -28
- data/lib/rspec-rayo/rayo/matchers/ask.rb +3 -3
- data/lib/rspec-rayo/rayo/matchers/call_control.rb +6 -6
- data/lib/rspec-rayo/rayo/matchers/conference.rb +4 -4
- data/lib/rspec-rayo/rayo/matchers/dtmf.rb +1 -1
- data/lib/rspec-rayo/rayo/matchers/input.rb +3 -3
- data/lib/rspec-rayo/rayo/matchers/join.rb +2 -2
- data/lib/rspec-rayo/rayo/matchers/output.rb +1 -1
- data/lib/rspec-rayo/rayo/matchers/recording.rb +2 -2
- data/lib/rspec-rayo/rayo/matchers/say.rb +1 -1
- data/lib/rspec-rayo/rayo/matchers/transfer.rb +2 -2
- data/lib/rspec-rayo/version.rb +1 -1
- metadata +20 -20
@@ -1,33 +1,10 @@
|
|
1
1
|
require 'rspec/expectations'
|
2
2
|
|
3
|
-
def execution_expired?(event)
|
4
|
-
if event == "execution expired"
|
5
|
-
@error = 'event was not delivered to queue before read timeout'
|
6
|
-
raise RSpec::Expectations::ExpectationNotMetError
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
def uuid_match?(uuid, type)
|
11
|
-
if uuid.match(/\A[\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12}/).nil?
|
12
|
-
@error = "#{type} == #{uuid} - expected a GUID"
|
13
|
-
raise RSpec::Expectations::ExpectationNotMetError
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
3
|
def match_type(object, type)
|
18
4
|
unless object.is_a?(type)
|
19
5
|
@error = "expected reason to be #{type}, got #{object}"
|
20
6
|
raise RSpec::Expectations::ExpectationNotMetError
|
21
7
|
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def basic_validation(object, klass, validate_component_id = false)
|
25
|
-
execution_expired? object
|
26
|
-
|
27
|
-
match_type object, klass
|
28
|
-
|
29
|
-
uuid_match? object.call_id, 'call_id'
|
30
|
-
uuid_match? object.component_id, 'cmd_id' if validate_component_id
|
31
8
|
|
32
9
|
yield if block_given?
|
33
10
|
|
@@ -49,7 +26,7 @@ end
|
|
49
26
|
|
50
27
|
RSpec::Matchers.define :have_executed_correctly do
|
51
28
|
match_for_should do |command|
|
52
|
-
|
29
|
+
match_type command, Punchblock::CommandNode do
|
53
30
|
unless command.executing?
|
54
31
|
@error = "expected status to be #{:executing.inspect}, got #{command.state_name}"
|
55
32
|
raise RSpec::Expectations::ExpectationNotMetError
|
@@ -68,7 +45,7 @@ end
|
|
68
45
|
|
69
46
|
RSpec::Matchers.define :have_dialed_correctly do
|
70
47
|
match_for_should do |call|
|
71
|
-
|
48
|
+
match_type call, RSpecRayo::Call do
|
72
49
|
call.ring_event.should be_a_valid_ringing_event
|
73
50
|
end
|
74
51
|
end
|
@@ -84,7 +61,7 @@ end
|
|
84
61
|
|
85
62
|
RSpec::Matchers.define :be_a_valid_complete_hangup_event do
|
86
63
|
match_for_should do |event|
|
87
|
-
|
64
|
+
match_type event, Punchblock::Event::Complete do
|
88
65
|
match_type event.reason, Punchblock::Event::Complete::Hangup
|
89
66
|
end
|
90
67
|
end
|
@@ -104,7 +81,7 @@ RSpec::Matchers.define :be_a_valid_complete_error_event do
|
|
104
81
|
end
|
105
82
|
|
106
83
|
match_for_should do |event|
|
107
|
-
|
84
|
+
match_type event, Punchblock::Event::Complete do
|
108
85
|
match_type event.reason, Punchblock::Event::Complete::Error
|
109
86
|
@error = "The error message was not correct. Expected '#{@message}', got '#{event.reason.details}'" if @message && event.reason.details != @message
|
110
87
|
end
|
@@ -123,7 +100,7 @@ end
|
|
123
100
|
|
124
101
|
RSpec::Matchers.define :be_a_valid_complete_stopped_event do
|
125
102
|
match_for_should do |event|
|
126
|
-
|
103
|
+
match_type event, Punchblock::Event::Complete do
|
127
104
|
match_type event.reason, Punchblock::Event::Complete::Stop
|
128
105
|
end
|
129
106
|
end
|
@@ -8,7 +8,7 @@ RSpec::Matchers.define :be_a_valid_successful_ask_event do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
match_for_should do |event|
|
11
|
-
|
11
|
+
match_type event, Punchblock::Event::Complete do
|
12
12
|
match_type event.reason, Punchblock::Component::Tropo::Ask::Complete::Success
|
13
13
|
@error = "The utterance was not correct. Expected '#{@utterance}', got '#{event.reason.utterance}'" if @utterance && event.reason.utterance != @utterance
|
14
14
|
@error = "The interpretation was not correct. Expected '#{@interpretation}', got '#{event.reason.interpretation}'" if @interpretation && event.reason.interpretation != @interpretation
|
@@ -29,7 +29,7 @@ end
|
|
29
29
|
|
30
30
|
RSpec::Matchers.define :be_a_valid_ask_noinput_event do
|
31
31
|
match_for_should do |event|
|
32
|
-
|
32
|
+
match_type event, Punchblock::Event::Complete do
|
33
33
|
match_type event.reason, Punchblock::Component::Tropo::Ask::Complete::NoInput
|
34
34
|
end
|
35
35
|
end
|
@@ -45,7 +45,7 @@ end
|
|
45
45
|
|
46
46
|
RSpec::Matchers.define :be_a_valid_ask_nomatch_event do
|
47
47
|
match_for_should do |event|
|
48
|
-
|
48
|
+
match_type event, Punchblock::Event::Complete do
|
49
49
|
match_type event.reason, Punchblock::Component::Tropo::Ask::Complete::NoMatch
|
50
50
|
end
|
51
51
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
RSpec::Matchers.define :be_a_valid_offer_event do
|
2
2
|
match_for_should do |event|
|
3
|
-
|
3
|
+
match_type event, Punchblock::Event::Offer do
|
4
4
|
event.headers_hash.each do |k,v|
|
5
5
|
if v.nil?
|
6
6
|
@error = "#{k.to_s} is nil - expected a value"
|
@@ -21,7 +21,7 @@ end
|
|
21
21
|
|
22
22
|
RSpec::Matchers.define :be_a_valid_answered_event do
|
23
23
|
match_for_should do |event|
|
24
|
-
|
24
|
+
match_type event, Punchblock::Event::Answered
|
25
25
|
end
|
26
26
|
|
27
27
|
failure_message_for_should do |actual|
|
@@ -35,7 +35,7 @@ end
|
|
35
35
|
|
36
36
|
RSpec::Matchers.define :be_a_valid_hangup_event do
|
37
37
|
match_for_should do |event|
|
38
|
-
|
38
|
+
match_type event, Punchblock::Event::End do
|
39
39
|
unless event.reason == :hangup
|
40
40
|
@error = "got #{event.reason.inspect} - expected :hangup"
|
41
41
|
raise RSpec::Expectations::ExpectationNotMetError
|
@@ -54,7 +54,7 @@ end
|
|
54
54
|
|
55
55
|
RSpec::Matchers.define :be_a_valid_ringing_event do
|
56
56
|
match_for_should do |event|
|
57
|
-
|
57
|
+
match_type event, Punchblock::Event::Ringing
|
58
58
|
end
|
59
59
|
|
60
60
|
failure_message_for_should do |actual|
|
@@ -68,7 +68,7 @@ end
|
|
68
68
|
|
69
69
|
RSpec::Matchers.define :be_a_valid_redirect_event do
|
70
70
|
match_for_should do |event|
|
71
|
-
|
71
|
+
match_type event, Punchblock::Event::End do
|
72
72
|
unless event.reason == :redirect
|
73
73
|
@error = "got #{event.reason.inspect} - expected :redirect"
|
74
74
|
raise RSpec::Expectations::ExpectationNotMetError
|
@@ -87,7 +87,7 @@ end
|
|
87
87
|
|
88
88
|
RSpec::Matchers.define :be_a_valid_reject_event do
|
89
89
|
match_for_should do |event|
|
90
|
-
|
90
|
+
match_type event, Punchblock::Event::End do
|
91
91
|
unless event.reason == :reject
|
92
92
|
@error = "got #{event.reason.inspect} - expected :reject"
|
93
93
|
raise RSpec::Expectations::ExpectationNotMetError
|
@@ -1,6 +1,6 @@
|
|
1
1
|
RSpec::Matchers.define :be_a_valid_conference_offhold_event do
|
2
2
|
match_for_should do |event|
|
3
|
-
|
3
|
+
match_type event, Punchblock::Component::Tropo::Conference::OffHold
|
4
4
|
end
|
5
5
|
|
6
6
|
failure_message_for_should do |actual|
|
@@ -18,7 +18,7 @@ RSpec::Matchers.define :be_a_valid_speaking_event do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
match_for_should do |event|
|
21
|
-
|
21
|
+
match_type event, Punchblock::Component::Tropo::Conference::Speaking do
|
22
22
|
@error = "The speaking call ID was not correct. Expected '#{@call_id}', got '#{event.speaking_call_id}'" if @call_id && event.speaking_call_id != @call_id
|
23
23
|
end
|
24
24
|
end
|
@@ -40,7 +40,7 @@ RSpec::Matchers.define :be_a_valid_finished_speaking_event do
|
|
40
40
|
end
|
41
41
|
|
42
42
|
match_for_should do |event|
|
43
|
-
|
43
|
+
match_type event, Punchblock::Component::Tropo::Conference::FinishedSpeaking do
|
44
44
|
@error = "The finished-speaking call ID was not correct. Expected '#{@call_id}', got '#{event.speaking_call_id}'" if @call_id && event.speaking_call_id != @call_id
|
45
45
|
end
|
46
46
|
end
|
@@ -58,7 +58,7 @@ end
|
|
58
58
|
|
59
59
|
RSpec::Matchers.define :be_a_valid_conference_complete_terminator_event do
|
60
60
|
match_for_should do |event|
|
61
|
-
|
61
|
+
match_type event, Punchblock::Event::Complete do
|
62
62
|
match_type event.reason, Punchblock::Component::Tropo::Conference::Complete::Terminator
|
63
63
|
end
|
64
64
|
end
|
@@ -4,7 +4,7 @@ RSpec::Matchers.define :be_a_valid_dtmf_event do
|
|
4
4
|
end
|
5
5
|
|
6
6
|
match_for_should do |event|
|
7
|
-
|
7
|
+
match_type event, Punchblock::Event::DTMF do
|
8
8
|
@error = "The signal was not correct. Expected '#{@signal}', got '#{event.signal}'" if @signal && event.signal != @signal
|
9
9
|
end
|
10
10
|
end
|
@@ -8,7 +8,7 @@ RSpec::Matchers.define :be_a_valid_successful_input_event do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
match_for_should do |event|
|
11
|
-
|
11
|
+
match_type event, Punchblock::Event::Complete do
|
12
12
|
match_type event.reason, Punchblock::Component::Input::Complete::Success
|
13
13
|
@error = "The utterance was not correct. Expected '#{@utterance}', got '#{event.reason.utterance}'" if @utterance && event.reason.utterance != @utterance
|
14
14
|
@error = "The interpretation was not correct. Expected '#{@interpretation}', got '#{event.reason.interpretation}'" if @interpretation && event.reason.interpretation != @interpretation
|
@@ -29,7 +29,7 @@ end
|
|
29
29
|
|
30
30
|
RSpec::Matchers.define :be_a_valid_input_noinput_event do
|
31
31
|
match_for_should do |event|
|
32
|
-
|
32
|
+
match_type event, Punchblock::Event::Complete do
|
33
33
|
match_type event.reason, Punchblock::Component::Input::Complete::NoInput
|
34
34
|
end
|
35
35
|
end
|
@@ -45,7 +45,7 @@ end
|
|
45
45
|
|
46
46
|
RSpec::Matchers.define :be_a_valid_input_nomatch_event do
|
47
47
|
match_for_should do |event|
|
48
|
-
|
48
|
+
match_type event, Punchblock::Event::Complete do
|
49
49
|
match_type event.reason, Punchblock::Component::Input::Complete::NoMatch
|
50
50
|
end
|
51
51
|
end
|
@@ -8,7 +8,7 @@ RSpec::Matchers.define :be_a_valid_joined_event do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
match_for_should do |event|
|
11
|
-
|
11
|
+
match_type event, Punchblock::Event::Joined do
|
12
12
|
@error = "The other call ID was not correct. Expected '#{@other_call_id}', got '#{event.other_call_id}'" if @other_call_id && event.other_call_id != @other_call_id
|
13
13
|
@error = "The mixer ID was not correct. Expected '#{@mixer_id}', got '#{event.mixer_id}'" if @mixer_id && event.mixer_id != @mixer_id
|
14
14
|
end
|
@@ -36,7 +36,7 @@ RSpec::Matchers.define :be_a_valid_unjoined_event do
|
|
36
36
|
end
|
37
37
|
|
38
38
|
match_for_should do |event|
|
39
|
-
|
39
|
+
match_type event, Punchblock::Event::Unjoined do
|
40
40
|
@error = "The other call ID was not correct. Expected '#{@other_call_id}', got '#{event.other_call_id}'" if @other_call_id && event.other_call_id != @other_call_id
|
41
41
|
@error = "The mixer ID was not correct. Expected '#{@mixer_id}', got '#{event.mixer_id}'" if @mixer_id && event.mixer_id != @mixer_id
|
42
42
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
RSpec::Matchers.define :be_a_valid_output_event do
|
2
2
|
match_for_should do |event|
|
3
|
-
|
3
|
+
match_type event, Punchblock::Event::Complete do
|
4
4
|
match_type event.reason, Punchblock::Component::Output::Complete::Success
|
5
5
|
end
|
6
6
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
RSpec::Matchers.define :be_a_valid_complete_recording_event do
|
2
2
|
match_for_should do |event|
|
3
|
-
|
3
|
+
match_type event, Punchblock::Event::Complete do
|
4
4
|
match_type event.recording, Punchblock::Component::Record::Recording
|
5
5
|
end
|
6
6
|
end
|
@@ -16,7 +16,7 @@ end
|
|
16
16
|
|
17
17
|
RSpec::Matchers.define :be_a_valid_stopped_recording_event do
|
18
18
|
match_for_should do |event|
|
19
|
-
|
19
|
+
match_type event, Punchblock::Event::Complete do
|
20
20
|
match_type event.reason, Punchblock::Event::Complete::Stop
|
21
21
|
match_type event.recording, Punchblock::Component::Record::Recording
|
22
22
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
RSpec::Matchers.define :be_a_valid_say_event do
|
2
2
|
match_for_should do |event|
|
3
|
-
|
3
|
+
match_type event, Punchblock::Event::Complete do
|
4
4
|
match_type event.reason, Punchblock::Component::Tropo::Say::Complete::Success
|
5
5
|
end
|
6
6
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
RSpec::Matchers.define :be_a_valid_transfer_event do
|
2
2
|
match_for_should do |event|
|
3
|
-
|
3
|
+
match_type event, Punchblock::Event::Complete do
|
4
4
|
match_type event.reason, Punchblock::Component::Tropo::Transfer::Complete::Success
|
5
5
|
end
|
6
6
|
end
|
@@ -16,7 +16,7 @@ end
|
|
16
16
|
|
17
17
|
RSpec::Matchers.define :be_a_valid_transfer_timeout_event do
|
18
18
|
match_for_should do |event|
|
19
|
-
|
19
|
+
match_type event, Punchblock::Event::Complete do
|
20
20
|
match_type event.reason, Punchblock::Component::Tropo::Transfer::Complete::Timeout
|
21
21
|
end
|
22
22
|
end
|
data/lib/rspec-rayo/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-rayo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.16
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,12 +10,12 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2011-10-
|
13
|
+
date: 2011-10-10 00:00:00.000000000 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rspec
|
18
|
-
requirement: &
|
18
|
+
requirement: &2169308840 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ! '>='
|
@@ -23,10 +23,10 @@ dependencies:
|
|
23
23
|
version: 2.6.0
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
|
-
version_requirements: *
|
26
|
+
version_requirements: *2169308840
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: punchblock
|
29
|
-
requirement: &
|
29
|
+
requirement: &2169308220 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
31
31
|
requirements:
|
32
32
|
- - ! '>='
|
@@ -34,10 +34,10 @@ dependencies:
|
|
34
34
|
version: 0.4.2
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
|
-
version_requirements: *
|
37
|
+
version_requirements: *2169308220
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
39
|
name: countdownlatch
|
40
|
-
requirement: &
|
40
|
+
requirement: &2169307540 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
43
|
- - ! '>='
|
@@ -45,10 +45,10 @@ dependencies:
|
|
45
45
|
version: 1.0.0
|
46
46
|
type: :runtime
|
47
47
|
prerelease: false
|
48
|
-
version_requirements: *
|
48
|
+
version_requirements: *2169307540
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
50
|
name: future-resource
|
51
|
-
requirement: &
|
51
|
+
requirement: &2169306880 !ruby/object:Gem::Requirement
|
52
52
|
none: false
|
53
53
|
requirements:
|
54
54
|
- - ! '>='
|
@@ -56,10 +56,10 @@ dependencies:
|
|
56
56
|
version: 0.0.2
|
57
57
|
type: :runtime
|
58
58
|
prerelease: false
|
59
|
-
version_requirements: *
|
59
|
+
version_requirements: *2169306880
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
61
|
name: yard
|
62
|
-
requirement: &
|
62
|
+
requirement: &2169306400 !ruby/object:Gem::Requirement
|
63
63
|
none: false
|
64
64
|
requirements:
|
65
65
|
- - ~>
|
@@ -67,10 +67,10 @@ dependencies:
|
|
67
67
|
version: 0.6.0
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
|
-
version_requirements: *
|
70
|
+
version_requirements: *2169306400
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: bundler
|
73
|
-
requirement: &
|
73
|
+
requirement: &2169305860 !ruby/object:Gem::Requirement
|
74
74
|
none: false
|
75
75
|
requirements:
|
76
76
|
- - ~>
|
@@ -78,10 +78,10 @@ dependencies:
|
|
78
78
|
version: 1.0.0
|
79
79
|
type: :development
|
80
80
|
prerelease: false
|
81
|
-
version_requirements: *
|
81
|
+
version_requirements: *2169305860
|
82
82
|
- !ruby/object:Gem::Dependency
|
83
83
|
name: rcov
|
84
|
-
requirement: &
|
84
|
+
requirement: &2169305240 !ruby/object:Gem::Requirement
|
85
85
|
none: false
|
86
86
|
requirements:
|
87
87
|
- - ! '>='
|
@@ -89,10 +89,10 @@ dependencies:
|
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
|
-
version_requirements: *
|
92
|
+
version_requirements: *2169305240
|
93
93
|
- !ruby/object:Gem::Dependency
|
94
94
|
name: rake
|
95
|
-
requirement: &
|
95
|
+
requirement: &2169304600 !ruby/object:Gem::Requirement
|
96
96
|
none: false
|
97
97
|
requirements:
|
98
98
|
- - ! '>='
|
@@ -100,10 +100,10 @@ dependencies:
|
|
100
100
|
version: '0'
|
101
101
|
type: :development
|
102
102
|
prerelease: false
|
103
|
-
version_requirements: *
|
103
|
+
version_requirements: *2169304600
|
104
104
|
- !ruby/object:Gem::Dependency
|
105
105
|
name: ci_reporter
|
106
|
-
requirement: &
|
106
|
+
requirement: &2169304120 !ruby/object:Gem::Requirement
|
107
107
|
none: false
|
108
108
|
requirements:
|
109
109
|
- - ! '>='
|
@@ -111,7 +111,7 @@ dependencies:
|
|
111
111
|
version: 1.6.3
|
112
112
|
type: :development
|
113
113
|
prerelease: false
|
114
|
-
version_requirements: *
|
114
|
+
version_requirements: *2169304120
|
115
115
|
description: Rspec2 Matchers for Rayo
|
116
116
|
email: jsgoecke@voxeo.com, ben@langfeld.me
|
117
117
|
executables: []
|