rspec_fixtures 0.0.2 → 0.1.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
  SHA1:
3
- metadata.gz: 48ef174e72d1e605f279b0d5ae0eedbf5b596fef
4
- data.tar.gz: 075e93191e3acbf083ddf892cb6a1a46caba54b2
3
+ metadata.gz: 14e49a8b56073fea93986bf29232749c67b38829
4
+ data.tar.gz: 1c0ea45ca68abb68a2ec175126a653bfef4c60a1
5
5
  SHA512:
6
- metadata.gz: 51fed96a9aca2abec950e09ddc47e6c9429f690ea4ab0f7e9864773aac82ed614b45bcd002842828fb6c31031efca6757cf151394c43e7202b80445d0731c15e
7
- data.tar.gz: 9373abab432d93d9f8d823c7cbb77a21352ee94d5041e53e4fe23913bcc9fa4a84dbce932280a43cd2227a658637ebf3c1a082cd2c6cd9170043054d0f8266b2
6
+ metadata.gz: 8248836925da316b8d0b53ba373df1a6ed386e5ccacd148cad704f0f52ffcebeda06d68d2496751287ce48c17561d4b14f3693f808ff7d88db36b2233a47669f
7
+ data.tar.gz: 0a140920b64dcbff8c8dfdc23fe787ccd9e878db2d8cf8dd8766ce9107d0cf6889d38208b8e99918fecee1d237f83185217848edd0bbfd42b8fcaf40eac0df21
data/README.md CHANGED
@@ -12,7 +12,7 @@ RSpec Fixtures
12
12
  RSpec Fixtures allows you to interactively review and approve testable
13
13
  content.
14
14
 
15
- ![Demo](/demo.gif)
15
+ [![asciicast](https://asciinema.org/a/150733.png)](https://asciinema.org/a/150733)
16
16
 
17
17
  ---
18
18
 
@@ -1,31 +1,39 @@
1
+ require 'colsole'
2
+
1
3
  module RSpecFixtures
2
4
  class ApprovalHandler
3
- include Colors
5
+ include Colsole
4
6
 
5
7
  def run(expected, actual, fixture_file)
6
- puts "%{blue}--- Approval Needed ---%{reset}\n" % colors
8
+ line = '_' * terminal_width
9
+
10
+ say "!txtgrn!#{line}"
7
11
  if expected.empty?
8
- puts actual
12
+ say actual
9
13
  else
10
- puts "--- New (Actual) ------%{reset}\n#{actual}" % colors
11
- puts "--- Old (Fixture) -----%{reset}\n#{expected}" % colors
14
+ say "> New (Actual):"
15
+ say actual
16
+ say "!txtpur!#{line}"
17
+ say "> Old (Fixture):"
18
+ say expected
12
19
  end
13
- print "%{blue}--- Approve? (y/N): --> %{reset}" % colors
20
+ say "!txtgrn!#{line}"
21
+ say "> Approve new fixture? (y/N): "
14
22
 
15
- if get_user_answer == "y"
16
- puts "%{green}Approved%{reset}" % colors
23
+ if user_approves?
24
+ say "!txtgrn!Approved"
17
25
  File.write fixture_file, actual
18
26
  true
19
27
  else
20
- puts "%{red}Not Approved%{reset}" % colors
28
+ say "!txtred!Not Approved"
21
29
  false
22
30
  end
23
31
  end
24
32
 
25
33
  private
26
34
 
27
- def get_user_answer
28
- $stdin.getch
35
+ def user_approves?
36
+ $stdin.getch == 'y'
29
37
  end
30
38
  end
31
39
  end
@@ -1,3 +1,3 @@
1
1
  module RSpecFixtures
2
- VERSION = "0.0.2"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -1,5 +1,4 @@
1
1
  require 'rspec_fixtures/version'
2
- require 'rspec_fixtures/colors'
3
2
 
4
3
  require 'rspec_fixtures/stream_capturer'
5
4
  require 'rspec_fixtures/approval_handler'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec_fixtures
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Ben Shitrit
@@ -103,7 +103,6 @@ files:
103
103
  - README.md
104
104
  - lib/rspec_fixtures.rb
105
105
  - lib/rspec_fixtures/approval_handler.rb
106
- - lib/rspec_fixtures/colors.rb
107
106
  - lib/rspec_fixtures/matchers/base.rb
108
107
  - lib/rspec_fixtures/matchers/match_fixture.rb
109
108
  - lib/rspec_fixtures/matchers/output_fixture.rb
@@ -1,11 +0,0 @@
1
- module RSpecFixtures
2
- module Colors
3
- def colors
4
- @colors ||= {
5
- reset: "\e[0m", black: "\e[30m", red: "\e[31m",
6
- green: "\e[32m", yellow: "\e[33m", blue: "\e[34m",
7
- magenta:"\e[35m", cyan: "\e[36m", white: "\e[37m",
8
- }
9
- end
10
- end
11
- end