Comments (8)
I will not be pulling in significant feature changes until we have a better test suite because it is difficult to fully test this plugin manually. High-level capybara tests with a dummy Rails app would be ideal. This can be done similar to the rails plugin new
command in the latest Rails 3.1 release.
Jasmine tests would also be nice to fully test the JavaScript API portion. See my private_pub project for an example of testing JavaScript through Jasmine.
from nested_form.
I had a little spike about using JS tests in nested_form. The result are not very good yet.
First - manually initializing dummy rails app inside specs is not as easy as I thought. If you use rack-test - everything is rather trivial, but if you want selenium or any other js interpreter - you should instantiate another rails server and work with it - so it need configs and other things. I didn't go further, but that will be rather hard, I think.
Another way to do acceptance testing is to use methods, that use guys from thoughtbot - generate new rails app, run specs on it, remove it. I didn't get very deep in that, so I'm not sure if this is the best thing we can do.
The other thing is to write unit tests with something like Jasmine having a pre-generated html form. The main problem here would be the need to test jquery / prototype version separately, but for now I think this will be the easiest way to achieve JS testing.
from nested_form.
First - manually initializing dummy rails app inside specs is not as easy as I thought. If you use rack-test - everything is rather trivial, but if you want selenium or any other js interpreter - you should instantiate another rails server and work with it - so it need configs and other things. I didn't go further, but that will be rather hard, I think.
Hmm, have you tried using the capybara and the Selenium support there? Maybe try another JS adapter like capybara-webkit?
Another way to do acceptance testing is to use methods, that use guys from thoughtbot - generate new rails app, run specs on it, remove it. I didn't get very deep in that, so I'm not sure if this is the best thing we can do.
This is basically how I test Nifty Generators, but it is quite slow and I don't think necessary here. I would rather stick to the pattern of rails plugin new
that Rails 3.1 provides.
The other thing is to write unit tests with something like Jasmine having a pre-generated html form. The main problem here would be the need to test jquery / prototype version separately, but for now I think this will be the easiest way to achieve JS testing.
I would like Jasmine unit tests as well, but I think acceptance-level tests are more critical at this point in time. Thanks for working on this!
from nested_form.
Hmm, have you tried using the capybara and the Selenium support there? Maybe try another JS adapter like capybara-webkit?
I tried Capybara + Selenium + manually made Rails.application object. Rack-test works cause it uses in-process app, as I understood, but Selenium driver boots another app instance, so the best way to implement acceptance tests - to generate apps on the fly or embed them inside project (as Jose Valim do in his "Crafting Rails Applications"). The other problem in this case - to support Rails 3.0 and 3.1.
from nested_form.
Looked at rails plugin new
. That's exactly what Jose used, but for supporting 3.0/3.1 we should make 2 almost identical apps and make them use different Gemfiles, etc.
from nested_form.
Looked at rails plugin new. That's exactly what Jose used, but for supporting 3.0/3.1 we should make 2 almost identical apps and make them use different Gemfiles, etc.
I would be happy with just focusing our tests on Rails 3.1 for now. We could probably do a simplified set of 3.0 tests later just to ensure the builder works okay.
Right now my main concern is testing the JavaScript and how it interacts with the Rails form builder. That hasn't changed much across 3.0 to 3.1.
from nested_form.
Check it out: #58
from nested_form.
#58 was merged so this issue can be closed.
from nested_form.
Related Issues (20)
- Can I add different subform (using STI)? HOT 3
- Remove labels
- Cusomized forms
- link_to_add make large index number
- wrong field name for the nested _destroy field
- Incremental counter for nested fields HOT 2
- nested_form shows extra fields after error messages HOT 1
- -
- Limit how many nested_attributes can be added? HOT 1
- undefined method `capture_position=' for nil:NilClass HOT 1
- link_to_remove is not deleted vale only hide that so when we update that send hide value in parmeter HOT 1
- nested_form for recursive Model HOT 1
- on clicking link_to_add nested forms not shown in rails HOT 1
- Sort nested form in edit view based on column HOT 1
- Bootsy wysiwyg editor not supported for nested forms HOT 3
- reject_if if 2 attributes are blank HOT 2
- Callbacks nested
- Link to remove not working as expected when :nested_wrapper is false HOT 1
- When I cleck on <%= f.link_to_add "Add a Step", :steps %>, nothing happens.
- Link_to_add, data: { target: } not working for a bootstrap modal pop up HOT 1
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.
from nested_form.