Skip to content

Commit

Permalink
#32 - Do not omit 'skip' when false otherwise you cannot unskip trans…
Browse files Browse the repository at this point in the history
…actions (#35)

* Do not omit 'skip' when false otherwise you cannot unskip transactions

* Update Gherkin spec to include non-omittable skip field

* Also update unit tests to include non-omitted skip field
  • Loading branch information
Anthony Davis authored and ddelnano committed Aug 21, 2017
1 parent f70ae5c commit 788fd17
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion features/step_definitions/dredd_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
sleep 1
data_received = @client.readline
if JSON.parse(data_received) != JSON.parse(@data_sent)
@client.close!
@client.close
raise "Data received:\n#{data_received}\nDoesn't match data sent: #{@data_sent}\n"
end
end
Expand Down
10 changes: 5 additions & 5 deletions features/tcp_server.feature
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Scenario: Message exchange for event beforeEach
And I connect to the server
And I send a JSON message to the socket:
"""
{"event": "beforeEach", "uuid": "1234-abcd", "data": {}}
{"event": "beforeEach", "uuid": "1234-abcd", "data": {"skip":true}}
"""
And I send a newline character as a message delimiter to the socket
Then I should receive same response
Expand All @@ -25,7 +25,7 @@ Scenario: Message exchange for event beforeEachValidation
And I connect to the server
And I send a JSON message to the socket:
"""
{"event": "beforeEachValidation", "uuid": "2234-abcd", "data": {}}
{"event": "beforeEachValidation", "uuid": "2234-abcd", "data": {"skip":false}}
"""
And I send a newline character as a message delimiter to the socket
Then I should receive same response
Expand All @@ -37,7 +37,7 @@ Scenario: Message exchange for event afterEach
And I connect to the server
And I send a JSON message to the socket:
"""
{"event": "afterEach", "uuid": "3234-abcd", "data": {}}
{"event": "afterEach", "uuid": "3234-abcd", "data": {"skip":true}}
"""
And I send a newline character as a message delimiter to the socket
Then I should receive same response
Expand All @@ -49,7 +49,7 @@ Scenario: Message exchange for event beforeAll
And I connect to the server
And I send a JSON message to the socket:
"""
{"event": "beforeAll", "uuid": "4234-abcd", "data": []}
{"event": "beforeAll", "uuid": "4234-abcd", "data": [{"skip":false}]}
"""
And I send a newline character as a message delimiter to the socket
Then I should receive same response
Expand All @@ -61,7 +61,7 @@ Scenario: Message exchange for event afterAll
And I connect to the server
And I send a JSON message to the socket:
"""
{"event": "afterAll", "uuid": "5234-abcd", "data": []}
{"event": "afterAll", "uuid": "5234-abcd", "data": [{"skip":true}]}
"""
And I send a newline character as a message delimiter to the socket
Then I should receive same response
Expand Down
10 changes: 5 additions & 5 deletions server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ func TestSendingServerMessages(t *testing.T) {
Payload []byte
}{
{
Payload: []byte("{\"uuid\":\"1234-abcd\",\"event\":\"beforeEach\",\"data\":{}}\n"),
Payload: []byte("{\"uuid\":\"1234-abcd\",\"event\":\"beforeEach\",\"data\":{\"skip\":false}}\n"),
},
{
Payload: []byte("{\"uuid\":\"2234-abcd\",\"event\":\"beforeEachValidation\",\"data\":{}}\n"),
Payload: []byte("{\"uuid\":\"2234-abcd\",\"event\":\"beforeEachValidation\",\"data\":{\"skip\":true}}\n"),
},
{
Payload: []byte("{\"uuid\":\"2234-abcd\",\"event\":\"afterEach\",\"data\":{}}\n"),
Payload: []byte("{\"uuid\":\"2234-abcd\",\"event\":\"afterEach\",\"data\":{\"skip\":false}}\n"),
},
{
Payload: []byte("{\"uuid\":\"2234-abcd\",\"event\":\"beforeAll\",\"data\":[]}\n"),
Payload: []byte("{\"uuid\":\"2234-abcd\",\"event\":\"beforeAll\",\"data\":[{\"skip\":true}]}\n"),
},
{
Payload: []byte("{\"uuid\":\"2234-abcd\",\"event\":\"afterAll\",\"data\":[]}\n"),
Payload: []byte("{\"uuid\":\"2234-abcd\",\"event\":\"afterAll\",\"data\":[{\"skip\":false}]}\n"),
},
}

Expand Down
2 changes: 1 addition & 1 deletion transaction/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type Transaction struct {
Origin *json.RawMessage `json:"origin,omitempty"`
Test *json.RawMessage `json:"test,omitempty"`
Results *json.RawMessage `json:"results,omitempty"`
Skip bool `json:"skip,omitempty"`
Skip bool `json:"skip"`
Fail interface{} `json:"fail,omitempty"`

TestOrder []string `json:"hooks_modifications,omitempty"`
Expand Down

0 comments on commit 788fd17

Please sign in to comment.