json_expressions 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,16 +1,21 @@
1
+ ### v0.8.2 [view commit logs](https://github.com/chancancode/json_expressions/compare/0.8.1...0.8.2)
2
+
3
+ * Bugfix: require 'rspec/core' instead of 'rspec' (#12 by @pda)
4
+ * Improved matcher output when using RSpec (#11 by @milkcocoa)
5
+ * Bugfix: fixed a bug where reusing the same matcher sometimes causes false negatives (#10 by @kophyo)
6
+ * Various documentation improvements
7
+ * Various Rakefile improvements. The gem now builds correctly on Travis
8
+
1
9
  ### v0.8.1 [view commit logs](https://github.com/chancancode/json_expressions/compare/0.8.0...0.8.1)
2
10
 
3
11
  * Fat finger: reverted a change in 0.8.0 which changed the default value of `assume_unordered_arrays` from true to false. Added tests to make sure this never happens again.
4
12
 
5
- ### v0.8.0 [view commit logs](https://github.com/chancancode/json_expressions/compare/0.7.3...0.8.0)
13
+ ### v0.8.0 [view commit logs](https://github.com/chancancode/json_expressions/compare/0.7.2...0.8.0)
6
14
 
7
15
  * Added Test::Unit support.
8
16
  * Added MiniTest::Spec support.
9
17
  * BREAKING: Changed internal structure of MiniTest support code. This shouldn't affect you unless you have been manually requiring and including the MiniTest helpers yourself.
10
18
  * Use of `WILDCARD_MATCHER` (the constant) inside a `MiniTest::Unit::TestCase` is now discouraged. Instead, you are encouraged to use `wildcard_matcher` (the method) instead. README has been updated.
11
-
12
- ### v0.7.3 [view commit logs](https://github.com/chancancode/json_expressions/compare/0.7.2...0.7.3)
13
-
14
19
  * Removed WILDCARD_MATCHER#match and the corresponding test. Since support for Object#match has been removed in v0.7.0, this should no longer be necessary.
15
20
 
16
21
  ### v0.7.2 [view commit logs](https://github.com/chancancode/json_expressions/compare/0.7.1...0.7.2)
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  JSON Expressions
2
2
  ================
3
3
 
4
+ [![Build Status](https://travis-ci.org/chancancode/json_expressions.png?branch=master)](https://travis-ci.org/chancancode/json_expressions)
5
+
4
6
  ## Introduction
5
7
 
6
8
  Your API is a contract between your service and your developers. It is important for you to know exactly what your JSON API is returning to the developers in order to make sure you don't accidentally change things without updating the documentations and/or bumping the API version number. Perhaps some controller tests for your JSON endpoints would help:
@@ -227,7 +229,7 @@ but not
227
229
  integer: Fixnum,
228
230
  float: Float,
229
231
  string: String,
230
- boolean: Boolean,
232
+ boolean: Boolean, # See http://stackoverflow.com/questions/3028243/check-if-ruby-object-is-a-boolean#answer-3028378
231
233
  array: Array,
232
234
  object: Hash,
233
235
  null: NilClass,
@@ -385,9 +387,9 @@ JsonExpressions::Matcher.assume_strict_arrays = false
385
387
  JsonExpressions::Matcher.assume_strict_hashes = false
386
388
  ```
387
389
 
388
- ## Support for `MiniTest::Spec` (and other testing frameworks)
390
+ ## Support for other test frameworks
389
391
 
390
- The `Matcher` class itself is written in a testing-framework-agnostic manner. This allows you to easily write custom helpers/matchers for your favorite testing framework. `MiniTest::Spec` is on my TODO list, but it is not a high priority for me personally, as I don't use it myself. If you need this now, write it yourself and submit a pull request - it's really easy, I promise (see `lib/json_expressions/minitest/unit/helpers.rb` for inspiration).
392
+ The `Matcher` class itself is written in a framework-agnostic manner. This allows you to easily write custom helpers/matchers for your favorite testing framework. If you wrote an adapter for another test frameworks and you'd like to share yhat with the world, please open a Pull Request.
391
393
 
392
394
  ## Contributing
393
395
 
@@ -50,9 +50,7 @@ module JsonExpressions
50
50
  match_json('(JSON ROOT)', @json, other)
51
51
  end
52
52
 
53
- def match(other)
54
- self =~ other
55
- end
53
+ alias_method :match, :=~
56
54
 
57
55
  def to_s
58
56
  @json.to_s
@@ -61,7 +59,7 @@ module JsonExpressions
61
59
  private
62
60
 
63
61
  def reset!
64
- @last_errot = nil
62
+ @last_error = nil
65
63
  @captures = {}
66
64
  end
67
65
 
@@ -206,4 +204,4 @@ module JsonExpressions
206
204
  end
207
205
  end
208
206
  end
209
- end
207
+ end
@@ -3,10 +3,6 @@ require 'minitest/spec'
3
3
  require 'json_expressions'
4
4
  require 'json_expressions/minitest/assertions'
5
5
 
6
- # module MiniTest::Assertions
7
- # include JsonExpressions::MiniTest::Assertions
8
- # end
9
-
10
6
  class MiniTest::Unit::TestCase
11
7
  WILDCARD_MATCHER = JsonExpressions::WILDCARD_MATCHER
12
8
 
@@ -1,4 +1,4 @@
1
- require 'rspec'
1
+ require 'rspec/core'
2
2
  require 'json_expressions'
3
3
  require 'json_expressions/rspec/matchers'
4
4
 
@@ -1,4 +1,5 @@
1
1
  require 'json'
2
+ require 'rspec/core'
2
3
 
3
4
  module JsonExpressions
4
5
  module RSpec
@@ -24,6 +25,10 @@ module JsonExpressions
24
25
  def failure_message_for_should_not
25
26
  "expected #{@target.inspect} not to match JSON expression #{@expected.inspect}"
26
27
  end
28
+
29
+ def description
30
+ "should equal JSON expression #{@expected.inspect}"
31
+ end
27
32
  end
28
33
 
29
34
  def match_json_expression(expected)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_expressions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-24 00:00:00.000000000 Z
12
+ date: 2013-02-07 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: JSON matchmaking for all your API testing needs.
15
15
  email:
@@ -51,7 +51,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
51
51
  version: 1.3.6
52
52
  requirements: []
53
53
  rubyforge_project:
54
- rubygems_version: 1.8.24
54
+ rubygems_version: 1.8.23
55
55
  signing_key:
56
56
  specification_version: 3
57
57
  summary: JSON Expressions