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

Rewrite tests to work on Rails 4.0, 4.1, 4.2, and 5.0 #273

Closed
mattbrictson opened this issue Jul 4, 2016 · 11 comments · Fixed by #278
Closed

Rewrite tests to work on Rails 4.0, 4.1, 4.2, and 5.0 #273

mattbrictson opened this issue Jul 4, 2016 · 11 comments · Fixed by #278

Comments

@mattbrictson
Copy link
Contributor

Right now the tests for bootstrap_form are hardcoded to work with Rails 4.0.0. As mentioned in #229, the tests break if one upgrades the Gemfile.lock to Rails 4.1 or newer. I think improving our testing is extremely important and should be our top priority before pursuing other features (e.g. Bootstrap 4 support).

Ideally our tests should pass on all supported versions of Rails, meaning 4.0, 4.1, 4.2, and 5.0.

Does anyone have suggestions for how we can accomplish this?

I will gladly accept a PR if you want to take a shot. Please make a proposal in this thread first before submitting a PR.

@koenpunt
Copy link
Contributor

koenpunt commented Jul 4, 2016

Rails 5 no longer outputs tag attributes in alphabetical order, so I think we need some kind of dynamic html matching (using nokogiri?). Also, additional tags are rendered in Rails 5, like an empty hidden input preceding a file input.
All the differences between output in Rails 4 vs 5 can be seen in the diff here: https://github.com/bootstrap-ruby/rails-bootstrap-forms/pull/269/files

@mattbrictson
Copy link
Contributor Author

I like the idea of using a HTML parser for matching expected output. Perhaps we could use rails-dom-testing, or nokogiri directly, as you mentioned.

@koenpunt
Copy link
Contributor

koenpunt commented Jul 5, 2016

rails-dom-testing seems suitable :)

@lcreid
Copy link
Contributor

lcreid commented Nov 17, 2016

The first paragraph of the rails-dom-testing README at https://github.com/rails/rails-dom-testing says that it only works on Rails 4.2 and above. The title of this issue includes Rails 4.0 and 4.1. Does that mean rails-dom-testing is out as an option?

@mattbrictson
Copy link
Contributor Author

@lcreid Yes, I would prefer to keep 4.0 compatibility if possible, so I guess that means rails-dom-testing is out.

@lcreid
Copy link
Contributor

lcreid commented Dec 9, 2016

I forked this project to https://github.com/lcreid/rails-bootstrap-forms. I used Nokogiri and equivalent-xml, and all the tests run green for Rails 4.0. It was way too easy, so I fear that I'm doing something wrong. Nevertheless, I'm willing to run with this for a while and see if you like what I'm doing, if you want to assign this issue to me.

I'll push what I've done so far to the explore branch of my project by the end of the evening Pacific Time, today (December 8).

@koenpunt
Copy link
Contributor

koenpunt commented Dec 9, 2016

I think equivalent-xml might be a good candidate. I've added it to #278, which tests with multi versions of rails already.

@lcreid
Copy link
Contributor

lcreid commented Dec 9, 2016

@koenpunt are we duplicating efforts here? What's the difference between #278 and #273 (this one)?

@koenpunt
Copy link
Contributor

koenpunt commented Dec 9, 2016

#273 is the issue, #278 is a pull request which I started like 5 months ago. And now that you suggested to use equivalent-xml I added your commit to that branch.

@lcreid
Copy link
Contributor

lcreid commented Dec 9, 2016 via email

@koenpunt
Copy link
Contributor

koenpunt commented Dec 9, 2016

@lcreid As you now can see on #278 is that I'm actually done implementing. But an extra review is always good :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants