capybara-json's People
Forkers
rickmzp ricoh mattconnolly mad-p sonots xforty therocketforever xieming laiyuncong8404 yuxichou yangfei1028 rocknrollmarc lanworlds aetherus irfanahmadein littlefatzhang liuweihere weiyunling wangchaoyu vickkyy isanfeng fromnowchange christmasboycapybara-json's Issues
NameError Exception: undefined local variable or method `json'
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.
Well this is sort of awkward
Add a license
undefined method `html' for #<Capybara::RackTestJson::Driver:0x007feb6a44c778> with Capybara2.0.2
When I call #source
or #body
method, this error appears.
It seems that no driver have #source
or #body
method anymore on Capyabara 2.0.1+. See teamcapybara/capybara@ae7c564. They are now just alias to #html
method in lib/capybara/session.rb, so a driver can have only #html
method effectively now. And the error on the title appears when we call #source
or #body
without #html
method defined.
FYI: I have not read carefully yet, but it seems that the change is basically coming from this issue teamcapybara/capybara#871. It seems that hey decided to integrate #source
and #body
to one #html
anyway.
Add support for Capybara::Session
When I run
@session = Capybara::Session.new(:rack_test_json)
@session.post('/some/path', {some: 'data'})
It just gives me NoMethodError: undefined method 'post' for #<Capybara::Session>
. The same for other HTTP verbs and .json
and .raw_json
.
When I design an web api for some sort of workflow, it's essential to write tests for cooperation among people who don't share sessions. Please think of adding support for Capybara::Session
or implement something similar.
Well this is sort of awkward
So this is kind of my Jon Stewart on Crossfire moment. I don't mean to offend you, but I feel that the premise of this gem is fundamentally flawed. You're basically (badly) replicating the functionality of RackTest, by going through a private undocumented Capybara API. Not only is this going to break in the future, but there's also not really a point to doing this, when you could just use RackTest directly.
I've seen people make this mistake a lot, so you're definitely not alone in this. I've blogged about it here: http://elabs.se/blog/34-capybara-and-testing-apis
Again, I really hope you don't take this personally. And I apologize for voicing this in a public forum, but there doesn't seem to be an email address on your GitHub profile.
(I previously sent this from my employer's GitHub account by accident, I want to stress that this is my opinion, and not my employer's)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.