minitest-assert-json-equal 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/README.md +2 -0
- data/Rakefile +5 -5
- data/lib/minitest-assert-json-equal.rb +17 -17
- data/lib/minitest-assert-json-equal/version.rb +1 -1
- data/minitest-assert-json-equal.gemspec +13 -13
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51506e03e055f1ee01f1119204b8e5803f2efb44
|
4
|
+
data.tar.gz: 5bb2016d2f84ec47b007b6e179ff7016486b753d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ede4781f279f9faf4de97a80a46c38e7a22f9537f585ecc0ded1ab251fa33389cc26a77c748e5f814c449e96bba1b0009210c05f39ab0c30a574dbaa0c58a110
|
7
|
+
data.tar.gz: b47c90c27b72c2c1b7ea59e547e16e3e0db92183a0a2267fda16b317b81a3b400a80e56e86bd83e537fae5e04a350bb420833dfa2795869d77563d2e4386f111
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# minitest-assert-json-equal
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/icco/minitest-assert-json-equal.svg?branch=master)](https://travis-ci.org/icco/minitest-assert-json-equal)
|
4
|
+
|
3
5
|
This adds two methods to your minitest: `assert_json_equal` and `refute_json_equal`. They don't care about the json string. They just make sure two things are true:
|
4
6
|
|
5
7
|
- the json parses.
|
data/Rakefile
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rake/testtask'
|
3
3
|
|
4
4
|
Rake::TestTask.new(:test) do |t|
|
5
|
-
t.libs <<
|
6
|
-
t.libs <<
|
5
|
+
t.libs << 'test'
|
6
|
+
t.libs << 'lib'
|
7
7
|
t.test_files = FileList['test/*_test.rb', 'test/**/*_test.rb']
|
8
8
|
end
|
9
9
|
|
10
|
-
task :
|
10
|
+
task default: :test
|
@@ -1,40 +1,40 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require 'minitest-assert-json-equal/version'
|
2
|
+
require 'minitest'
|
3
|
+
require 'json'
|
4
4
|
|
5
5
|
module MinitestAssertJsonEqual
|
6
6
|
end
|
7
7
|
|
8
8
|
module Minitest::Assertions
|
9
|
-
def assert_json_equal(json_a, json_b, msg=nil)
|
9
|
+
def assert_json_equal(json_a, json_b, msg = nil)
|
10
10
|
a = JSON.parse(json_a)
|
11
11
|
b = JSON.parse(json_b)
|
12
12
|
|
13
|
-
msg = message(msg,
|
14
|
-
|
15
|
-
|
13
|
+
msg = message(msg, '') do
|
14
|
+
'Expected json to match.'
|
15
|
+
end
|
16
16
|
|
17
17
|
assert_equal a, b, msg
|
18
18
|
rescue JSON::ParserError
|
19
|
-
msg = message(msg,
|
20
|
-
|
21
|
-
|
19
|
+
msg = message(msg, '') do
|
20
|
+
'JSON does not parse.'
|
21
|
+
end
|
22
22
|
flunk msg
|
23
23
|
end
|
24
24
|
|
25
|
-
def refute_json_equal(json_a, json_b, msg=nil)
|
25
|
+
def refute_json_equal(json_a, json_b, msg = nil)
|
26
26
|
a = JSON.parse(json_a)
|
27
27
|
b = JSON.parse(json_b)
|
28
28
|
|
29
|
-
msg = message(msg,
|
30
|
-
|
31
|
-
|
29
|
+
msg = message(msg, '') do
|
30
|
+
'Expected json to match.'
|
31
|
+
end
|
32
32
|
|
33
33
|
refute_equal a, b, msg
|
34
34
|
rescue JSON::ParserError
|
35
|
-
msg = message(msg,
|
36
|
-
|
37
|
-
|
35
|
+
msg = message(msg, '') do
|
36
|
+
'JSON does not parse.'
|
37
|
+
end
|
38
38
|
flunk msg
|
39
39
|
end
|
40
40
|
end
|
@@ -4,28 +4,28 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'minitest-assert-json-equal/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'minitest-assert-json-equal'
|
8
8
|
spec.version = MinitestAssertJsonEqual::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
9
|
+
spec.authors = ['Nat Welch']
|
10
|
+
spec.email = ['nat@natwelch.com']
|
11
11
|
|
12
|
-
spec.summary =
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
12
|
+
spec.summary = 'A gem to compare json strings to see if they are similar.'
|
13
|
+
spec.homepage = 'https://github.com/icco/minitest-assert-json-equal'
|
14
|
+
spec.license = 'MIT'
|
15
15
|
|
16
16
|
if spec.respond_to?(:metadata)
|
17
|
-
spec.metadata['allowed_push_host'] =
|
17
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
18
18
|
else
|
19
|
-
raise
|
19
|
+
raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.'
|
20
20
|
end
|
21
21
|
|
22
22
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
23
|
-
spec.bindir =
|
23
|
+
spec.bindir = 'exe'
|
24
24
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
25
|
-
spec.require_paths = [
|
25
|
+
spec.require_paths = ['lib']
|
26
26
|
|
27
|
-
spec.add_development_dependency
|
28
|
-
spec.add_development_dependency
|
27
|
+
spec.add_development_dependency 'bundler', '~> 1.12'
|
28
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
29
29
|
|
30
|
-
spec.add_dependency
|
30
|
+
spec.add_dependency 'minitest', '~> 5.0'
|
31
31
|
end
|