Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions spec/cucumber/core/event_bus_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# frozen_string_literal: true

require 'cucumber/core/event_bus'

module Cucumber
module Core
module Events
Expand Down
2 changes: 0 additions & 2 deletions spec/cucumber/core/event_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# frozen_string_literal: true

require 'cucumber/core/event'

describe Cucumber::Core::Event do
describe '.new' do
it 'generates new types of events' do
Expand Down
1 change: 0 additions & 1 deletion spec/cucumber/core/report/summary_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# frozen_string_literal: true

require 'cucumber/core/event_bus'
require 'cucumber/core/events'
require 'cucumber/core/report/summary'
require 'cucumber/core/test/result'
require 'cucumber/core/test/step'
Expand Down
2 changes: 0 additions & 2 deletions spec/cucumber/core/test/case_spec.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# frozen_string_literal: true

require 'cucumber/core'
require 'cucumber/core/gherkin/writer'
require 'cucumber/core/platform'
require 'cucumber/core/test/case'

describe Cucumber::Core::Test::Case do
include Cucumber::Core
Expand Down
2 changes: 0 additions & 2 deletions spec/cucumber/core/test/location_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# frozen_string_literal: true

require 'cucumber/core/test/location'

module Cucumber
module Core
module Test
Expand Down
2 changes: 1 addition & 1 deletion spec/cucumber/core/test/runner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

require 'cucumber/core/test/around_hook'
require 'cucumber/core/test/hook_step'
require 'cucumber/core/test/runner'
require 'cucumber/core/test/case'
require 'cucumber/core/test/step'

require 'support/duration_matcher'

describe Cucumber::Core::Test::Runner do
Expand Down
25 changes: 12 additions & 13 deletions spec/cucumber/core/test/step_spec.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# frozen_string_literal: true

require 'cucumber/core/test/step'

describe Cucumber::Core::Test::Step do
let(:id) { 'some-random-uid' }
let(:text) { 'step text' }
let(:location) { double }
let(:location) { { line: 3, column: 5 } }

describe 'describing itself' do
it 'describes itself to a visitor' do
visitor = double
args = double
test_step = described_class.new(id, text, location)

expect(visitor).to receive(:test_step).with(test_step, args)

test_step.describe_to(visitor, args)
end
end
Expand All @@ -35,12 +35,14 @@
args_spy = actual_args
end
test_step.execute(*expected_args)

expect(args_spy).to eq expected_args
end

context 'when a passing action exists' do
it 'returns a passing result' do
test_step = described_class.new(id, text, location).with_action { :no_op }

expect(test_step.execute).to be_passed
end
end
Expand All @@ -51,6 +53,7 @@
it 'returns a failing result' do
test_step = described_class.new(id, text, location).with_action { raise exception }
result = test_step.execute

expect(result).to be_failed
expect(result.exception).to eq exception
end
Expand All @@ -60,27 +63,23 @@
it 'returns an Undefined result' do
test_step = described_class.new(id, text, location)
result = test_step.execute

expect(result).to be_undefined
end
end
end

it 'exposes the text and location of as attributes' do
test_step = described_class.new(id, text, location)
expect(test_step.text).to eq text
expect(test_step.location).to eq location
end

it 'exposes the location of the action as attribute' do
location = double
it 'exposes the location of the action as attribute as `#action_location`' do
action = instance_double(Cucumber::Core::Test::Action::Defined, location: location)
test_step = described_class.new(id, text, location, action)
test_step = described_class.new(id, text, location, :a_blank_multiline_arg, action)

expect(test_step.action_location).to eq(location)
end

it 'returns the text when converted to a string' do
text = 'a passing step'
test_step = described_class.new(id, text, location)
expect(test_step.to_s).to eq 'a passing step'

expect(test_step.to_s).to eq('a passing step')
end
end
1 change: 0 additions & 1 deletion spec/cucumber/core_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
require 'support/report_api_spy'
require 'support/activate_steps_for_self_test'

require 'cucumber/core'
require 'cucumber/core/filter'
require 'cucumber/core/gherkin/writer'
require 'cucumber/core/platform'
Expand Down