features/lexer.feature in ruby_ami-2.0.0 vs features/lexer.feature in ruby_ami-2.1.0

- old
+ new

@@ -5,174 +5,141 @@ Scenario: Lexing only the initial AMI version header Given a new lexer And a version header for AMI 1.0 - When the buffer is lexed - Then the protocol should have lexed without syntax errors And the version should be set to 1.0 Scenario: Lexing the initial AMI header and a login attempt Given a new lexer And a version header for AMI 1.0 And a normal login success with events - When the buffer is lexed - Then the protocol should have lexed without syntax errors And 1 message should have been received Scenario: Lexing the initial AMI header and then a Response:Follows section Given a new lexer And a version header for AMI 1.0 - And a multi-line Response:Follows body of ragel_description + And a multi-line Response:Follows body of show_channels_from_wayne - When the buffer is lexed - Then the protocol should have lexed without syntax errors - And the 'follows' body of 1 message received should equal ragel_description + And the 'follows' body of 1 message received should equal show_channels_from_wayne Scenario: Lexing a Response:Follows section with no body Given a new lexer And a version header for AMI 1.0 And a multi-line Response:Follows body of empty_String - When the buffer is lexed - Then the protocol should have lexed without syntax errors And the 'follows' body of 1 message received should equal empty_string Scenario: Lexing a multi-line Response:Follows simulating the "core show channels" command Given a new lexer And a version header for AMI 1.0 Given a multi-line Response:Follows body of show_channels_from_wayne - When the buffer is lexed - Then the protocol should have lexed without syntax errors And the 'follows' body of 1 message received should equal show_channels_from_wayne Scenario: Lexing a multi-line Response:Follows simulating the "core show uptime" command Given a new lexer And a version header for AMI 1.0 Given a multi-line Response:Follows response simulating uptime - When the buffer is lexed - Then the protocol should have lexed without syntax errors And the first message received should have a key "System uptime" with value "46 minutes, 30 seconds" Scenario: Lexing a Response:Follows section which has a colon not on the first line Given a new lexer And a multi-line Response:Follows body of with_colon_after_first_line - When the buffer is lexed - Then the protocol should have lexed without syntax errors And 1 message should have been received And the 'follows' body of 1 message received should equal with_colon_after_first_line @wip Scenario: Lexing an immediate response with a colon in it. Given a new lexer And an immediate response with text "markq has 0 calls (max unlimited) in 'ringall' strategy (0s holdtime), W:0, C:0, A:0, SL:0.0% within 0s\r\n No Members\r\n No Callers\r\n\r\n\r\n\r\n" - When the buffer is lexed - Then the protocol should have lexed without syntax errors And 1 message should have been received And 1 message should be an immediate response with text "markq has 0 calls (max unlimited) in 'ringall' strategy (0s holdtime), W:0, C:0, A:0, SL:0.0% within 0s\r\n No Members\r\n No Callers" Scenario: Lexing the initial AMI header and then an "Authentication Required" error. Given a new lexer And a version header for AMI 1.0 And an Authentication Required error - When the buffer is lexed - Then the protocol should have lexed without syntax errors Scenario: Lexing the initial AMI header and then a Response:Follows section Given a new lexer And a version header for AMI 1.0 - And a multi-line Response:Follows body of ragel_description - And a multi-line Response:Follows body of ragel_description + And a multi-line Response:Follows body of show_channels_from_wayne + And a multi-line Response:Follows body of show_channels_from_wayne - When the buffer is lexed - Then the protocol should have lexed without syntax errors - And the 'follows' body of 2 messages received should equal ragel_description + And the 'follows' body of 2 messages received should equal show_channels_from_wayne Scenario: Lexing a stanza without receiving an AMI header Given a new lexer And a normal login success with events - When the buffer is lexed - Then the protocol should have lexed without syntax errors And 1 message should have been received Scenario: Receiving an immediate response as soon as the socket is opened Given a new lexer And an immediate response with text "Immediate responses are so ridiculous" - When the buffer is lexed - Then the protocol should have lexed without syntax errors And 1 message should have been received And 1 message should be an immediate response with text "Immediate responses are so ridiculous" Scenario: Receiving an immediate message surrounded by real messages Given a new lexer And a normal login success with events And an immediate response with text "No queues have been created." And a normal login success with events - When the buffer is lexed - Then the protocol should have lexed without syntax errors And 3 messages should have been received And 1 message should be an immediate response with text "No queues have been created." Scenario: Receiving a Pong after a simulated login Given a new lexer And a version header for AMI 1.0 And a normal login success with events And a Pong response with an ActionID of randomness - When the buffer is lexed - Then the protocol should have lexed without syntax errors And 2 messages should have been received Scenario: Ten Pong responses in a row Given a new lexer And 5 Pong responses without an ActionID And 5 Pong responses with an ActionID of randomness - When the buffer is lexed - Then the protocol should have lexed without syntax errors And 10 messages should have been received Scenario: A Pong with an ActionID Given a new lexer And a Pong response with an ActionID of 1224469850.61673 - When the buffer is lexed - Then the first message received should have a key "ActionID" with value "1224469850.61673" Scenario: A response containing a floating point value Given a new lexer And a custom stanza named "call" And the custom stanza named "call" has key "ActionID" with value "1224469850.61673" And the custom stanza named "call" has key "Uniqueid" with value "1173223225.10309" When the custom stanza named "call" is added to the buffer - And the buffer is lexed Then the 1st message received should have a key "Uniqueid" with value "1173223225.10309" Scenario: Receiving a message with custom key/value pairs Given a new lexer @@ -184,11 +151,10 @@ And the custom stanza named "person" has key "x-header" with value "<FooBAR>" And the custom stanza named "person" has key "Channel" with value "IAX2/127.0.0.1/4569-9904" And the custom stanza named "person" has key "I have spaces" with value "i have trailing padding " When the custom stanza named "person" is added to the buffer - And the buffer is lexed Then the protocol should have lexed without syntax errors And the first message received should have a key "Name" with value "Jay Phillips" And the first message received should have a key "ActionID" with value "1224469850.61673" And the first message received should have a key "Name" with value "Jay Phillips" @@ -200,22 +166,18 @@ Scenario: Executing a stanza that was partially received Given a new lexer And a normal login success with events split into two pieces - When the buffer is lexed - Then the protocol should have lexed without syntax errors And 1 message should have been received Scenario: Receiving an AMI error followed by a normal event Given a new lexer And an AMI error whose message is "Missing action in request" And a normal login success with events - When the buffer is lexed - Then the protocol should have lexed without syntax errors And 1 AMI error should have been received And the 1st AMI error should have the message "Missing action in request" And 1 message should have been received @@ -223,12 +185,10 @@ Given a new lexer And a normal login success with events And an immediate response with text "Yes, plain English is sent sometimes over AMI." And a normal login success with events - When the buffer is lexed - Then the protocol should have lexed without syntax errors And 3 messages should have been received And 1 message should be an immediate response with text "Yes, plain English is sent sometimes over AMI." Scenario: Lexing an AMI event @@ -237,11 +197,10 @@ And a custom header for event identified by "this_event" whose key is "Foo" and value is "Bar" And a custom header for event identified by "this_event" whose key is "Channel" and value is "IAX2/127.0.0.1:4569-9904" And a custom header for event identified by "this_event" whose key is "AppData" and value is "agi://localhost" When the custom event identified by "this_event" is added to the buffer - And the buffer is lexed Then the protocol should have lexed without syntax errors And 1 event should have been received And the 1st event should have the name "NewChannelEvent" And the 1st event should have key "Foo" with value "Bar" @@ -250,11 +209,9 @@ Scenario: Lexing an immediate packet with a colon in it (syntax error) Given a new lexer And syntactically invalid immediate_packet_with_colon And a stanza break - - When the buffer is lexed Then 0 messages should have been received And the protocol should have lexed with 1 syntax error And the syntax error fixture named immediate_packet_with_colon should have been encountered