From 15ec8c3937069638d009be9117dad9156af99e7b Mon Sep 17 00:00:00 2001 From: Vincent Pretre Date: Wed, 15 Apr 2020 14:44:57 +0200 Subject: [PATCH] Use new messages from v12 --- lib/cucumber/core/gherkin/parser.rb | 5 ++--- lib/cucumber/core/test/result.rb | 24 ++++++++++++------------ spec/cucumber/core/test/result_spec.rb | 12 ++++++------ 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/lib/cucumber/core/gherkin/parser.rb b/lib/cucumber/core/gherkin/parser.rb index abc3f311..a867da1b 100644 --- a/lib/cucumber/core/gherkin/parser.rb +++ b/lib/cucumber/core/gherkin/parser.rb @@ -25,9 +25,8 @@ def document(document) event_bus.gherkin_source_parsed(message.gherkin_document) elsif !message.pickle.nil? receiver.pickle(message.pickle) - elsif !message.attachment.nil? - # Parse error - raise Core::Gherkin::ParseError.new("#{document.uri}: #{message.attachment.body}") + elsif message.parse_error + raise Core::Gherkin::ParseError.new("#{document.uri}: #{message.parse_error.message}") else raise "Unknown message: #{message.to_hash}" end diff --git a/lib/cucumber/core/test/result.rb b/lib/cucumber/core/test/result.rb index 77ba3d7c..a8f77283 100644 --- a/lib/cucumber/core/test/result.rb +++ b/lib/cucumber/core/test/result.rb @@ -44,8 +44,8 @@ def with_filtered_backtrace(filter) end def to_message - Cucumber::Messages::TestStepResult.new( - status: Cucumber::Messages::TestStepResult::Status::UNKNOWN, + Cucumber::Messages::TestStepFinished::TestStepResult.new( + status: Cucumber::Messages::TestStepFinished::TestStepResult::Status::UNKNOWN, duration: UnknownDuration.new.to_message_duration ) end @@ -75,8 +75,8 @@ def to_s end def to_message - Cucumber::Messages::TestStepResult.new( - status: Cucumber::Messages::TestStepResult::Status::PASSED, + Cucumber::Messages::TestStepFinished::TestStepResult.new( + status: Cucumber::Messages::TestStepFinished::TestStepResult::Status::PASSED, duration: duration.to_message_duration ) end @@ -128,8 +128,8 @@ def to_message message = "" end - Cucumber::Messages::TestStepResult.new( - status: Cucumber::Messages::TestStepResult::Status::FAILED, + Cucumber::Messages::TestStepFinished::TestStepResult.new( + status: Cucumber::Messages::TestStepFinished::TestStepResult::Status::FAILED, duration: duration.to_message_duration, message: message ) @@ -216,8 +216,8 @@ def to_s end def to_message - Cucumber::Messages::TestStepResult.new( - status: Cucumber::Messages::TestStepResult::Status::UNDEFINED, + Cucumber::Messages::TestStepFinished::TestStepResult.new( + status: Cucumber::Messages::TestStepFinished::TestStepResult::Status::UNDEFINED, duration: duration.to_message_duration ) end @@ -241,8 +241,8 @@ def to_s end def to_message - Cucumber::Messages::TestStepResult.new( - status: Cucumber::Messages::TestStepResult::Status::SKIPPED, + Cucumber::Messages::TestStepFinished::TestStepResult.new( + status: Cucumber::Messages::TestStepFinished::TestStepResult::Status::SKIPPED, duration: duration.to_message_duration ) end @@ -266,8 +266,8 @@ def to_s end def to_message - Cucumber::Messages::TestStepResult.new( - status: Cucumber::Messages::TestStepResult::Status::PENDING, + Cucumber::Messages::TestStepFinished::TestStepResult.new( + status: Cucumber::Messages::TestStepFinished::TestStepResult::Status::PENDING, duration: duration.to_message_duration ) end diff --git a/spec/cucumber/core/test/result_spec.rb b/spec/cucumber/core/test/result_spec.rb index d7418a22..66dbcfa9 100644 --- a/spec/cucumber/core/test/result_spec.rb +++ b/spec/cucumber/core/test/result_spec.rb @@ -25,7 +25,7 @@ module Cucumber::Core::Test it "converts to a Cucumber::Message::TestResult" do message = result.to_message - expect(message.status).to eq(Cucumber::Messages::TestStepResult::Status::PASSED) + expect(message.status).to eq(Cucumber::Messages::TestStepFinished::TestStepResult::Status::PASSED) end it "has a duration" do @@ -75,7 +75,7 @@ module Cucumber::Core::Test it "converts to a Cucumber::Message::TestResult" do message = result.to_message - expect(message.status).to eq(Cucumber::Messages::TestStepResult::Status::FAILED) + expect(message.status).to eq(Cucumber::Messages::TestStepFinished::TestStepResult::Status::FAILED) end it "requires both constructor arguments" do @@ -144,7 +144,7 @@ module Cucumber::Core::Test it "converts to a Cucumber::Message::TestResult" do message = result.to_message - expect(message.status).to eq(Cucumber::Messages::TestStepResult::Status::UNKNOWN) + expect(message.status).to eq(Cucumber::Messages::TestStepFinished::TestStepResult::Status::UNKNOWN) end end @@ -207,7 +207,7 @@ module Cucumber::Core::Test it "converts to a Cucumber::Message::TestResult" do message = result.to_message - expect(message.status).to eq(Cucumber::Messages::TestStepResult::Status::UNDEFINED) + expect(message.status).to eq(Cucumber::Messages::TestStepFinished::TestStepResult::Status::UNDEFINED) end specify { expect( result.to_sym ).to eq :undefined } @@ -236,7 +236,7 @@ module Cucumber::Core::Test it "converts to a Cucumber::Message::TestResult" do message = result.to_message - expect(message.status).to eq(Cucumber::Messages::TestStepResult::Status::SKIPPED) + expect(message.status).to eq(Cucumber::Messages::TestStepFinished::TestStepResult::Status::SKIPPED) end specify { expect( result.to_sym ).to eq :skipped } @@ -263,7 +263,7 @@ module Cucumber::Core::Test it "converts to a Cucumber::Message::TestResult" do message = result.to_message - expect(message.status).to eq(Cucumber::Messages::TestStepResult::Status::PENDING) + expect(message.status).to eq(Cucumber::Messages::TestStepFinished::TestStepResult::Status::PENDING) end specify { expect( result.to_sym ).to eq :pending }