Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NameError Exception: undefined local variable or method `json' #9

Closed
sonots opened this issue Jan 6, 2013 · 1 comment · Fixed by #10
Closed

NameError Exception: undefined local variable or method `json' #9

sonots opened this issue Jan 6, 2013 · 1 comment · Fixed by #10

Comments

@sonots
Copy link
Collaborator

sonots commented Jan 6, 2013

I get the above error when I use capybara-json as README says:

require 'capybara/json'
include Capybara::Json

Capybara.current_driver = :rack_test_json
post '/', { "this is" => "json" } # POST '/'
json   #=> NameError Exception: undefined local variable or method `json' 

This should be because Capybara::Session::DSL_METHODS https://github.com/jnicklas/capybara/blob/master/lib/capybara/session.rb#L45 does not include json methods, thus json DSL is not created.

Basically, this bug is caused because test cases for mix-in usage are completely lacked. Test cases using driver directly is not enough.


I also think that it would be nice to run the mix-in usage test cases with various versions of capybara because capybara people sometimes changes driver interfaces, etc and affects capybara-json. It would also be nice to write explicitly down that capybara-json supports what versions of capybara if possible. For this purpose, bundler-auto-update would be useful.

@sonots
Copy link
Collaborator Author

sonots commented Jan 6, 2013

json and raw-json DSL is added by 8c26f01#L1R33, but the test cases are still lacked. Let me keep this issue.

@sonots sonots mentioned this issue Jan 8, 2013
@sonots sonots closed this as completed Jan 12, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant