Fix for NameError: uninitialized constant HelpersTest::JSON #703

Merged
merged 1 commit into from Apr 7, 2013

Conversation

Projects
None yet
4 participants
Contributor

viliampucik commented Mar 31, 2013

Fixes the following test error:

test_should_not_reset_the_content_type_to_html_for_error_handlers_0(HelpersTest::TestError):
NameError: uninitialized constant HelpersTest::JSON
Contributor

JonRowe commented Apr 1, 2013

Interesting... why hasn't this been needed until now? Is requiring it in the test_helper masking the real problem? I'm guessing sinatra doesn't require 'json' directly to allow you to pick your JSON library, in fact the only place it does require it is in one of the test files test/rabl_test.rb.

Owner

rkh commented Apr 2, 2013

Sinatra does not require json as Sinatra doesn't do anything with json.

Contributor

JonRowe commented Apr 2, 2013

Yes of couse, In my head I some how had it that a templating mode might, or that it'd be used for mime type matching, but that'd never make sense.

Member

patriciomacadden commented Apr 7, 2013

I think this PR should be merged because running the helpers_test standalone (ruby -I lib:test test/helpers_test.rb) produces the error that @viliampucik is describing. This line uses JSON.dump, which is not being required.

This is not failing when running rake test because json is required in test/rabl_test.rb, as @JonRowe said.

It's clear that Sinatra does not require json, but the tests needs to require json.

rkh added a commit that referenced this pull request Apr 7, 2013

Merge pull request #703 from viliampucik/master
Fix for NameError: uninitialized constant HelpersTest::JSON

@rkh rkh merged commit bc60373 into sinatra:master Apr 7, 2013

1 check passed

default The Travis build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment