pretty-diffs 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +44 -8
- data/images/after.png +0 -0
- data/images/before.png +0 -0
- data/lib/pretty_diffs.rb +1 -1
- data/lib/pretty_diffs/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7cc6ffd50247d89fb5f28fb2a724dd2744374250
|
4
|
+
data.tar.gz: 3ebe45d328166a23036aa0aa27061f282e42ab3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87b22876ba598b003f9d9e0e77c4c953ff2c5d7bc244c1a05880cda812575f605f8f867dbba76ea947a31f6392a1d0264b73f45b26e3179dfa5fa1d2da96cd85
|
7
|
+
data.tar.gz: f5787eabfe593c3defc9b5fc91330f8f6a033f69405d0731f17f60b5131d59e2f432e00afdff5c4e1ce9e0233757473f6e0e806b9a43e1c222bb6bb045ba6bbe
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,10 +1,15 @@
|
|
1
1
|
# PrettyDiffs
|
2
2
|
|
3
|
-
|
3
|
+
A small gem to lubricate your testing workflow with prettier than usual diffs.
|
4
4
|
|
5
|
-
|
5
|
+
## Motivation
|
6
|
+
When you make assertions between large strings with Minitest, for example JSON responses, it is laborious to identify what has changed. The usual workflow involves copy-pasting the output into a diff tool; a rather boring and time-consuming process.
|
6
7
|
|
7
|
-
|
8
|
+
Minitest chooses to compare strings using `diff`, which is line-oriented. However, 99% of the time, we do not intend to compare lines, we want just the words.
|
9
|
+
|
10
|
+
PrettyDiffs is a tool that supports this desire by overriding the default Minitest method, and relieves our workflow.
|
11
|
+
|
12
|
+
## Screenshots
|
8
13
|
### Default Diff output
|
9
14
|
![before](./images/before.png)
|
10
15
|
|
@@ -18,7 +23,7 @@ Wdiff is a wrapper around diff, it works by creating two temporary files, one w
|
|
18
23
|
|
19
24
|
```
|
20
25
|
# mac
|
21
|
-
$ brew install wdiff
|
26
|
+
$ brew install wdiff
|
22
27
|
|
23
28
|
# linux
|
24
29
|
$ apt get-install wdiff
|
@@ -30,7 +35,7 @@ Add this line to your application's Gemfile:
|
|
30
35
|
|
31
36
|
```ruby
|
32
37
|
group :test do
|
33
|
-
gem '
|
38
|
+
gem 'pretty-diffs'
|
34
39
|
end
|
35
40
|
```
|
36
41
|
|
@@ -43,10 +48,10 @@ $ bundle
|
|
43
48
|
Or install it yourself as:
|
44
49
|
|
45
50
|
```
|
46
|
-
$ gem install
|
51
|
+
$ gem install pretty-diffs
|
47
52
|
```
|
48
53
|
|
49
|
-
##
|
54
|
+
## How to use
|
50
55
|
Include the module in the Minitest classes to trigger the pretty diffs:
|
51
56
|
|
52
57
|
```ruby
|
@@ -54,7 +59,7 @@ require 'pretty_diffs'
|
|
54
59
|
|
55
60
|
module ActiveSupport
|
56
61
|
class TestCase
|
57
|
-
include PrettyDiffs
|
62
|
+
include PrettyDiffs # add this line
|
58
63
|
|
59
64
|
end
|
60
65
|
end
|
@@ -67,6 +72,13 @@ In this rare case, set the following ENV variable:
|
|
67
72
|
MINITEST_PLAIN_BORING_DIFF='yes'
|
68
73
|
```
|
69
74
|
|
75
|
+
## Tests
|
76
|
+
```sh
|
77
|
+
$ rake
|
78
|
+
```
|
79
|
+
|
80
|
+
## Tasks for version 1.1.0
|
81
|
+
* Pure JSON output instead of Hash when comparing JSON responses in controller tests, so to copy-paste directly.
|
70
82
|
|
71
83
|
## Contributing
|
72
84
|
|
@@ -75,3 +87,27 @@ MINITEST_PLAIN_BORING_DIFF='yes'
|
|
75
87
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
76
88
|
4. Push to the branch (`git push origin my-new-feature`)
|
77
89
|
5. Create new Pull Request
|
90
|
+
|
91
|
+
## License
|
92
|
+
|
93
|
+
The MIT License (MIT)
|
94
|
+
|
95
|
+
Copyright (c) 2016 Angelos Karagkiozidis
|
96
|
+
|
97
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
98
|
+
of this software and associated documentation files (the "Software"), to deal
|
99
|
+
in the Software without restriction, including without limitation the rights
|
100
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
101
|
+
copies of the Software, and to permit persons to whom the Software is
|
102
|
+
furnished to do so, subject to the following conditions:
|
103
|
+
|
104
|
+
The above copyright notice and this permission notice shall be included in
|
105
|
+
all copies or substantial portions of the Software.
|
106
|
+
|
107
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
108
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
109
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
110
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
111
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
112
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
113
|
+
THE SOFTWARE.
|
data/images/after.png
CHANGED
Binary file
|
data/images/before.png
CHANGED
Binary file
|
data/lib/pretty_diffs.rb
CHANGED
data/lib/pretty_diffs/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pretty-diffs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Angelos Karagkiozidis
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -94,9 +94,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
94
|
version: '0'
|
95
95
|
requirements: []
|
96
96
|
rubyforge_project:
|
97
|
-
rubygems_version: 2.6.
|
97
|
+
rubygems_version: 2.6.13
|
98
98
|
signing_key:
|
99
99
|
specification_version: 4
|
100
100
|
summary: Enable colored diffs in minitest.
|
101
101
|
test_files: []
|
102
|
-
has_rdoc:
|