Module: AssertJson
- Defined in:
- lib/assert_json/version.rb,
lib/assert_json/assert_json.rb
Overview
nodoc
Defined Under Namespace
Classes: Json
Constant Summary collapse
- VERSION =
"0.4.1"
Instance Method Summary collapse
- #assert_json(json_string) {|@json| ... } ⇒ Object
- #has(*args, &block) ⇒ Object
- #has_length_of(expected) ⇒ Object
- #item(index, &block) ⇒ Object
- #not?(*args, &block) ⇒ Boolean (also: #has_not)
- #only? ⇒ Boolean (also: #has_only)
Instance Method Details
#assert_json(json_string) {|@json| ... } ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/assert_json/assert_json.rb', line 3 def assert_json(json_string) return unless block_given? @json = AssertJson::Json.new(json_string) # json.instance_exec(json, &block) yield @json @json.test_for_unexpected_keys('root') end |
#has(*args, &block) ⇒ Object
20 21 22 |
# File 'lib/assert_json/assert_json.rb', line 20 def has(*args, &block) @json.has(*args, &block) end |
#has_length_of(expected) ⇒ Object
12 13 14 |
# File 'lib/assert_json/assert_json.rb', line 12 def has_length_of(expected) @json.has_length_of(expected) end |
#item(index, &block) ⇒ Object
16 17 18 |
# File 'lib/assert_json/assert_json.rb', line 16 def item(index, &block) @json.item(index, &block) end |
#not?(*args, &block) ⇒ Boolean Also known as: has_not
24 25 26 |
# File 'lib/assert_json/assert_json.rb', line 24 def not?(*args, &block) @json.has_not(*args, &block) end |
#only? ⇒ Boolean Also known as: has_only
29 30 31 |
# File 'lib/assert_json/assert_json.rb', line 29 def only? @json.has_only end |