diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2021-05-30 23:48:23 -0600 |
|---|---|---|
| committer | Dan Allen <dan.j.allen@gmail.com> | 2021-07-30 03:44:44 -0600 |
| commit | 2e708e8fe4ede93f807485330057b9c197f5d538 (patch) | |
| tree | c412ef3a34e3aed4cede1c2ab1bfcab3fd4d3225 /features | |
| parent | b7a7cf66641d7215d267a8a7dbf50efc74497eb5 (diff) | |
replace rspec expectations with minitest assertions in feature tests
Diffstat (limited to 'features')
| -rw-r--r-- | features/step_definitions.rb | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/features/step_definitions.rb b/features/step_definitions.rb index 68aa2f82..b6a270ff 100644 --- a/features/step_definitions.rb +++ b/features/step_definitions.rb @@ -8,10 +8,20 @@ require 'simplecov' if ENV['COVERAGE'] == 'true' require File.join ASCIIDOCTOR_LIB_DIR, 'asciidoctor' Dir.chdir Asciidoctor::ROOT_DIR -require 'rspec/expectations' +require 'minitest' require 'tilt' require 'slim' +assertions = Class.new do + include Minitest::Assertions + + attr_accessor :assertions + + def initialize + @assertions = 0 + end +end.new + Given %r/the AsciiDoc source/ do |source| @source = source end @@ -25,8 +35,7 @@ When %r/it is converted to docbook/ do end Then %r/the result should (match|contain) the (HTML|XML) source/ do |matcher, _, expected| - match_expectation = matcher == 'match' ? (eq expected) : (include expected) - (expect @output).to match_expectation + matcher == 'match' ? (assertions.assert_equal expected, @output) : (assertions.assert_includes @output, expected) end Then %r/the result should (match|contain) the (HTML|XML) structure/ do |matcher, format, expected| @@ -39,6 +48,5 @@ Then %r/the result should (match|contain) the (HTML|XML) structure/ do |matcher, end result = Slim::Template.new(options) { result.each_line.map {|l| (l.start_with? '<') ? l : %(|#{l}) }.join }.render expected = Slim::Template.new(options) { expected }.render - match_expectation = matcher == 'match' ? (eq expected) : (include expected) - (expect result).to match_expectation + matcher == 'match' ? (assertions.assert_equal expected, result) : (assertions.assert_includes result, expected) end |
