Skip to content

Commit

Permalink
Use new messages from v12
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-psarga committed Apr 15, 2020
1 parent 9f64be5 commit 15ec8c3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 21 deletions.
5 changes: 2 additions & 3 deletions lib/cucumber/core/gherkin/parser.rb
Expand Up @@ -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
Expand Down
24 changes: 12 additions & 12 deletions lib/cucumber/core/test/result.rb
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
)
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
12 changes: 6 additions & 6 deletions spec/cucumber/core/test/result_spec.rb
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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 }
Expand Down Expand Up @@ -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 }
Expand All @@ -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 }
Expand Down

0 comments on commit 15ec8c3

Please sign in to comment.