crudecumber 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 51041fb1f9682732ba15e49644ebd35dadafc5fc
4
- data.tar.gz: 034b03ad1c311d10ff6147a2d7a8212ef94a1c4f
3
+ metadata.gz: ebec09de75b420af5162185adb4496b7f369a6e2
4
+ data.tar.gz: e1eac67bd6b33a2e83b85dfdb6b0b7a8abc1a503
5
5
  SHA512:
6
- metadata.gz: 28747083bedf4f3bb505bb7c448a5681004b99f05cbab56e642bfd6ef5469693f1872ae91ccdcc713ad89b5b536584592b922bcf8e5a67fb396ee1ca9a346044
7
- data.tar.gz: 1ce431c0d52b62f00f2233913bb2d2af232663d4d232a20bcfdca0b79d9ab7cf695bf430340378a4b10c8584babca2709915d17904f8931a229344b7b96486e2
6
+ metadata.gz: 7cfdf10e4ad6a45054a59f8a4206195a77330afc2e4247edf12ea5d95ac99ba8dc7b2100cf7f9a1f6f6147cb79a70e0b9d72f1e67889832473ba4d26c44e3d99
7
+ data.tar.gz: 3f2c717341d948ac920ebe6e862d3a0b0f408a4913c7e48879b73a59a937cb3f12681c5c35b486963ffe3bec1d1af63c8d0b74f20b1b44e1e4a620e914d1accf
@@ -11,39 +11,35 @@ module Crudecumber
11
11
  class Formatter < Cucumber::Formatter::Pretty
12
12
  def before_step(step)
13
13
  @io.printf "#{step.keyword}#{step.name}".indent(@scenario_indent + 2)
14
- unless step.multiline_arg.nil?
14
+ case step.multiline_arg
15
+ when Cucumber::Ast::Table
15
16
  @io.printf "#{step.multiline_arg}".indent(@scenario_indent + 2)
17
+ when Cucumber::Ast::DocString
18
+ @io.printf "\n"
19
+ @io.printf "\"\"\"\n#{step.multiline_arg}\n\"\"\"".indent(@scenario_indent + 4)
16
20
  end
17
21
  super
18
22
  end
19
23
 
20
24
  def before_step_result(*args)
21
- is_table = args[2].is_a?(Cucumber::Ast::Table)
22
- table_rows = is_table ? args[2].raw.length : 0
23
-
24
- if is_table # If there is a table
25
- case args[3]
26
- when :failed
27
- @io.printf "\033[#{table_rows + 3}A"
28
- when :pending
29
- @io.printf "\033[#{table_rows + 1}A"
30
- when :passed
31
- @io.printf "\033[#{table_rows + 1}A"
32
- when :skipped
33
- @io.printf "\033[#{table_rows + 1}A"
34
- end
25
+ case args[2]
26
+ when Cucumber::Ast::Table
27
+ clear_multiline(args[2].raw.length, args)
28
+ when Cucumber::Ast::DocString
29
+ clear_multiline(args[2].lines.count + 1, args)
35
30
  else
36
- case args[3]
37
- when :failed
38
- @io.printf "\033[2A"
39
- end
31
+ @io.printf "\033[2A" if args[3] == :failed
40
32
  end
41
33
  @io.printf "\r\033[K"
42
34
  super
43
35
  end
44
36
 
45
- def exception(_arg_1, _arg_2)
46
- # Do nothing
37
+ def clear_multiline(height, args)
38
+ if args[3] == :failed
39
+ @io.printf "\r" + ("\e[A\e[K" * (height + 3))
40
+ else
41
+ @io.printf "\r" + ("\e[A\e[K" * (height + 1))
42
+ end
47
43
  end
48
44
 
49
45
  def table_cell_value(value, status)
@@ -53,9 +49,13 @@ module Crudecumber
53
49
  cell_text = escape_cell(value.to_s || '')
54
50
  padded = cell_text + (' ' * (width - cell_text.unpack('U*').length))
55
51
  prefix = cell_prefix(status)
56
- @io.print(' ' + format_string("#{prefix} #{padded}", status) + ::Cucumber::Term::ANSIColor.reset(' |'))
52
+ @io.print(' ' + format_string("#{prefix}#{padded}", status) + ::Cucumber::Term::ANSIColor.reset(' |'))
57
53
  @io.flush
58
54
  end
55
+
56
+ def exception(_arg_1, _arg_2)
57
+ # Do nothing
58
+ end
59
59
  end
60
60
 
61
61
  # Custom formatter that inherits from the standard Cucumber 'Html' formatter
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crudecumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Buckland
@@ -30,11 +30,9 @@ dependencies:
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
32
  version: 1.3.3
33
- description: |-
34
- Manually run through your Cucumber scenarios.
35
-
36
- Run exactly as you would run Cucumber but instead use 'crudecumber' followed
37
- by your usual arguments.
33
+ description: "Manually run through your Cucumber scenarios.\n\n Hit 'P' to pass a
34
+ step, 'F' to fail, or 'S' to skip! \n\n Run exactly as you would run Cucumber but
35
+ instead use 'crudecumber' followed\n by your usual Cucumber arguments."
38
36
  email: me@danb.io
39
37
  executables:
40
38
  - crudecumber
@@ -70,5 +68,5 @@ rubyforge_project:
70
68
  rubygems_version: 2.6.10
71
69
  signing_key:
72
70
  specification_version: 4
73
- summary: Crudecumber 0.3.1
71
+ summary: A manual Cucumber runner
74
72
  test_files: []