rspec_approvals 0.8.1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4e597cb175306f5f78a5dac55499abb08f1cd6d70cd5726b366b090314922c58
4
- data.tar.gz: 4d969a9b3c2be1fe22feddca704c22e5c1b9dfd050585ad4449072d2dbb53d95
3
+ metadata.gz: 3f80fb19dffbe4bc78a84f29d2adc564b99daab370cc17b1594f8c4b07fd5ead
4
+ data.tar.gz: 8877ef773cc9c266b32fcb871fabb93113f8019a82494cefcc056f8b50a9ad60
5
5
  SHA512:
6
- metadata.gz: 0eb1bf41d01c3fe7a3eff0d06393b1ca11aa85c9373e3e5969969ccb1f1a5b2a3b71861c3395e4033c09af5df4b6df848aa9f67dc01dd256d3dab240d2269a6c
7
- data.tar.gz: 60e038625da45685d5bb387894569d93355366a6db0b6b99d360e264df56ecd0a7997f811c24122035e8ce46bfbf5ff3c93e3fe849b49af9671aa343fe3be1a0
6
+ metadata.gz: b684ba876cfd55a31ff064fcf559ad999b2f7daf57d8b257865d910499e883b50d35b5e956b59259f0b2979764612c04832c650e0517a50b2b2aa206ab4f12d5
7
+ data.tar.gz: 60bf2c56a847a03d525af17b04c68013709b99d142f42035081f5672940479ae16f23167b115f486e191b5c3aa9533149bf3e80562c0d55c4fc078a783f323bf
@@ -1,7 +1,7 @@
1
1
  require 'rspec_approvals/extensions/file'
2
- require 'rspec_approvals/extensions/stringio'
3
2
 
4
3
  require 'rspec_approvals/module_functions'
4
+ require 'rspec_approvals/prompt'
5
5
  require 'rspec_approvals/stream'
6
6
  require 'rspec_approvals/approval_handler'
7
7
  require 'rspec_approvals/matchers/base'
@@ -1,6 +1,5 @@
1
1
  require 'io/console'
2
2
  require 'colsole'
3
- require 'tty-prompt'
4
3
  require 'diffy'
5
4
 
6
5
  module RSpecApprovals
@@ -20,10 +19,6 @@ module RSpecApprovals
20
19
  prompt_user
21
20
  end
22
21
 
23
- def prompt
24
- @prompt ||= TTY::Prompt.new
25
- end
26
-
27
22
  private
28
23
 
29
24
  def prompt_user
@@ -49,23 +44,19 @@ module RSpecApprovals
49
44
  end
50
45
 
51
46
  def get_response
52
- prompt.select "Please Choose:", menu_options, symbols: { marker: '>' }
53
- rescue TTY::Reader::InputInterrupt
54
- # :nocov:
55
- return :reject
56
- # :nocov:
47
+ Prompt.select "Please Choose:", 'r', menu_options
57
48
  end
58
49
 
59
50
  def menu_options
60
51
  base = {
61
- 'Reject (and fail test)' => :reject,
62
- 'Approve (and save)' => :approve,
52
+ 'a' => ['Approve (and save)', :approve],
53
+ 'r' => ['Reject (and fail test)', :reject]
63
54
  }
64
55
 
65
56
  extra = {
66
- 'Show actual output' => :actual,
67
- 'Show expected output' => :expected,
68
- 'Show diff' => :diff,
57
+ '1' => ['Show actual output', :actual],
58
+ '2' => ['Show expected output', :expected],
59
+ '3' => ['Show diff', :diff]
69
60
  }
70
61
 
71
62
  expected.empty? ? base : base.merge(extra)
@@ -0,0 +1,25 @@
1
+ require 'io/console'
2
+ require 'colsole'
3
+
4
+ module RSpecApprovals
5
+ class Prompt
6
+ class << self
7
+ include Colsole
8
+
9
+ def select(prompt, default, options)
10
+ options.each do |key, config|
11
+ color = key == default ? 'txtred' : 'txtgrn'
12
+ say "!#{color}!#{key}!txtrst!) #{config.first}"
13
+ end
14
+
15
+ say "\n!txtblu!#{prompt}!txtrst! "
16
+ response = STDIN.getch.downcase
17
+
18
+ response = default unless options.has_key? response
19
+
20
+ resay "!txtpur!#{options[response].first}"
21
+ options[response].last
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,3 +1,3 @@
1
1
  module RSpecApprovals
2
- VERSION = "0.8.1"
2
+ VERSION = "0.9.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec_approvals
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Ben Shitrit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-17 00:00:00.000000000 Z
11
+ date: 2020-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colsole
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.3'
55
- - !ruby/object:Gem::Dependency
56
- name: tty-prompt
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '0.19'
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '0.19'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: strings-ansi
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -90,12 +76,12 @@ files:
90
76
  - lib/rspec_approvals.rb
91
77
  - lib/rspec_approvals/approval_handler.rb
92
78
  - lib/rspec_approvals/extensions/file.rb
93
- - lib/rspec_approvals/extensions/stringio.rb
94
79
  - lib/rspec_approvals/matchers/base.rb
95
80
  - lib/rspec_approvals/matchers/match_approval.rb
96
81
  - lib/rspec_approvals/matchers/output_approval.rb
97
82
  - lib/rspec_approvals/matchers/raise_approval.rb
98
83
  - lib/rspec_approvals/module_functions.rb
84
+ - lib/rspec_approvals/prompt.rb
99
85
  - lib/rspec_approvals/rspec_config.rb
100
86
  - lib/rspec_approvals/stream.rb
101
87
  - lib/rspec_approvals/version.rb
@@ -1,21 +0,0 @@
1
- # This is a fix for a pesky issue with tty-screen (dependency of tty-reader,
2
- # which is a dependency of tty-prompt, which is a dependency of ours).
3
- # ref: https://github.com/piotrmurach/tty-screen/issues/11
4
- require 'stringio'
5
-
6
- unless StringIO.method_defined? :ioctl
7
- class StringIO
8
- def ioctl(*)
9
- 80
10
- end
11
- end
12
- end
13
-
14
- unless StringIO.method_defined? :wait_readable
15
- class StringIO
16
- def wait_readable(*)
17
- true
18
- end
19
- end
20
- end
21
-