Class: TC_JSONFixtures
- Defined in:
- lib/crazy_ivan/vendor/json-1.1.7/tests/test_json_fixtures.rb
Instance Method Summary collapse
Instance Method Details
#setup ⇒ Object
12 13 14 15 16 17 |
# File 'lib/crazy_ivan/vendor/json-1.1.7/tests/test_json_fixtures.rb', line 12 def setup fixtures = File.join(File.dirname(__FILE__), 'fixtures/*.json') passed, failed = Dir[fixtures].partition { |f| f['pass'] } @passed = passed.inject([]) { |a, f| a << [ f, File.read(f) ] }.sort @failed = failed.inject([]) { |a, f| a << [ f, File.read(f) ] }.sort end |
#test_failing ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/crazy_ivan/vendor/json-1.1.7/tests/test_json_fixtures.rb', line 26 def test_failing for name, source in @failed assert_raises(JSON::ParserError, JSON::NestingError, "Did not fail for fixture '#{name}'") do JSON.parse(source) end end end |