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

Rails3 un-obstructive JS doesn't work #34

Open
sserdyuk opened this issue Sep 12, 2010 · 10 comments
Open

Rails3 un-obstructive JS doesn't work #34

sserdyuk opened this issue Sep 12, 2010 · 10 comments

Comments

@sserdyuk
Copy link

Hi, I have a very simple app written in Rails 3 on Ruby 1.8.7. I have a form with :remote => true, which initiates an AJAX POST request on form submission. The code works in a regular browser, and it works with regular Capibara's selenium driver. If I switch to capybara-envjs the form submits though a normal html mode. Please advise.

My env.rb
require 'capybara/envjs'
Capybara.javascript_driver = :envjs
Capybara.app = Rails3Mongo::Application

My Gemfile
gem 'capybara-envjs'
gem 'database_cleaner', :git => 'git://github.com/bmabey/database_cleaner.git'
gem 'cucumber-rails', :git => 'git://github.com/aslakhellesoy/cucumber-rails.git'
gem "rspec-rails", ">=2.0.0.beta.5"
gem 'cucumber'

My feature:
@javascript
Scenario: Editing a comment
Given There are 10 posts
Given The first post has 3 comments
Given I am on the first comment edit page
When I press "Update Comment"
Then Visual effect has to run

@smparkes
Copy link
Owner

I think this has been fixed in master but hasn't been released as a gem release (waiting on a compatible-capy release).

@sserdyuk
Copy link
Author

Thank you. I've noticed I can't pull a gem from the git repo directly. I'll be waiting.

@snelson
Copy link

snelson commented Oct 10, 2010

Thanks for all the work you've done on this driver, it has been extremely useful to me. Any reason you don't include a .gemspec in the repo so we can build our own gem? I'm interested in some of the latest changes and possibly also forking/fixing some things if needed, or until they get in the latest release.

@smparkes
Copy link
Owner

Pretty much because the people I was cloning from didn't release gemspecs. You can make the argument that gemspecs shouldn't/can't be maintained between releases. Same folks tend to disagree on how you should manage the gem manifest (manually curated vs. something like Dir[*/]).

Since I've been using Hoe, it wasn't so easy to extract a gemspec but I think I saw last week that someone had added a Hoe extension to save the gemspec, so I guess I just need to get around to doing that ...

@smparkes
Copy link
Owner

If you want to create a new issue for adding the gemspec it's less like I'll forget it. Alternatively, if you have a patch with the appropriate hoe magic ...

@kendagriff
Copy link

I've had the same problem here: a Javascript xhr request works under the normal Capybara driver, but with envjs, it calls the standard HTML template. I've got the 'master' branch.

In debugging the line #197, with the supposed fixed, xhr.headers["Accept"] is nil.

Thank you again – I Iook forward to using the envjs. Any thoughts?

@smparkes
Copy link
Owner

If someone has a patch with a test, I'll accept it. If someone has a test where I can easily replicate the issue, I'll try to find time to look at it ..

@kendagriff
Copy link

I appreciate your response. I've replicated the issue in a simple Rails 3.0.0 app at http://github.com/kendagriff/envjs-test. README describes how to replicate the problem.

My apologies if there is user error, but thanks again for any help you can provide.

@smparkes
Copy link
Owner

Thanks. I'll try to take a look at it soon ...

@smparkes
Copy link
Owner

smparkes commented Nov 3, 2010

I was wrong when I thought this was fixed. There was a fix for headers that got put in, but (as the title indicates) this is actually an unobtrusive javascript problem.

Rails3 does a lot more with bubbling events (jquery 1.4 does this, too) and the support for this in env-js (at least the johnson branch) is not very strong.

It needs someone to pick it up and go over it, but I'm not going to have the right mix of time and need any time soon, I don't think.

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

No branches or pull requests

4 participants