Closed JasonBarnabe closed 6 years ago
Thanks for the contribution.
As I mentioned, I'm not happy merging things in until there is a CI build setup.
In terms of the PR itself...
I haven't seen this deprecation warning and I'm running Rails v5.1.5
... Steps to reproduce?
This occurred when exporting to CSV in Rails 5.0.x. I would imagine this would raise an exception on 5.1.x.
@patricklindsay I've added a test for this. This path was not covered previously by the specs.
With the updated test, but without the fix, Rails 5.0 is a pass with a deprecation warning, and Rails 5.1 is an expectation fail.
~/wice_grid (master) $ appraisal rspec spec/features/csv_export_request_spec.rb
>> BUNDLE_GEMFILE=/Users/jasonbarnabe/wice_grid/gemfiles/rails_5.0.gemfile bundle exec rspec spec/features/csv_export_request_spec.rb
-- create_table("dummies", {:force=>:cascade})
-> 0.0302s
-- initialize_schema_migrations_table()
-> 0.0133s
CSV export WiceGrid
DEPRECATION WARNING: `render :text` is deprecated because it does not actually render a `text/plain` response. Switch to `render plain: 'plain text'` to render as `text/plain`, `render html: '<strong>HTML</strong>'` to render as `text/html`, or `render body: 'raw'` to match the deprecated behavior and render with the default Content-Type, which is `text/html`. (called from block in send_file_rails2 at /Users/jasonbarnabe/wice_grid/lib/wice/wice_grid_controller.rb:182)
should export csv
Finished in 4.68 seconds (files took 3.02 seconds to load)
1 example, 0 failures
[Coveralls] Outside the CI environment, not sending data.
Coverage report generated for RSpec to /Users/jasonbarnabe/wice_grid/coverage. 1421 / 2768 LOC (51.34%) covered.
>> BUNDLE_GEMFILE=/Users/jasonbarnabe/wice_grid/gemfiles/rails_5.1.gemfile bundle exec rspec spec/features/csv_export_request_spec.rb
-- create_table("dummies", {:force=>:cascade})
-> 0.0044s
CSV export WiceGrid
should export csv (FAILED - 1)
Failures:
1) CSV export WiceGrid should export csv
Failure/Error: expect(page.body).to include('ID;Title;Priority;Status;Project Name;')
expected "<!DOCTYPE html><html><head>\n\n<link rel=\"stylesheet\" media=\"all\" href=\"/assets/application-897...a>\n</li>\n<li>\n<a href=\"/auto_reloads3\">Aut</a></li></ul></div></div></div></div></body></html>" to include "ID;Title;Priority;Status;Project Name;"
Diff:
@@ -1,2 +1,132 @@
-ID;Title;Priority;Status;Project Name;
+<!DOCTYPE html><html><head>
+
+<link rel="stylesheet" media="all" href="/assets/application-8979cb157c426c89449933dbe70f241046f442b707885b4edbecdf4585b78618.css" data-turbolinks-track="true">
+<script src="/assets/application-6351436aad316f510936b65afdc1185fffaf0cc7f054aa573e49192c8c9d0dc0.js" data-turbolinks-track="true"></script>
+
+<title>WiceGrid Examples</title></head>
+<body>
+<div class="container-fluid">
+<header>
+<h1>WiceGrid 3.6.0.pre4 examples</h1>
+<div class="example-navigator">
+<ul class="pager">
+<li class="previous">
+<a href="/all_records">← Previous</a>
+</li>
+<li class="next">
+<a href="/csv_and_detached_filters">Next →</a>
+</li>
+</ul>
+</div>
+<div class="clear"></div>
+</header>
+<div class="row-fluid">
+<div class="col-md-3">
+<div class="well">
+<ul class="nav nav-pills nav-stacked">
+<li class="nav-header">Basics</li>
+<li>
+<a href="/basics1">Most simple grid</a>
+</li>
+<li>
+<a href="/basics2">Named columns</a>
+</li>
+<li>
+<a href="/upper_pagination_panel">Two pagination panels</a>
+</li>
+<li>
+<a href="/basics3">Associating columns with database fields</a>
+</li>
+<li>
+<a href="/blockless_column_definition">Dropping the block in #column</a>
+</li>
+<li>
+<a href="/numeric_filters">Numeric filters</a>
+</li>
+<li>
+<a href="/many_grids_on_page">More than 1 grid on a page</a>
+</li>
+<li>
+<a href="/basics4">Disabling filters</a>
+</li>
+<li>
+<a href="/disable_all_filters">Disabling all filters</a>
+</li>
+<li>
+<a href="/dates">Date/Datetime helpers</a>
+</li>
+<li>
+<a href="/when_filtered">Hidden filter panel</a>
+</li>
+<li>
+<a href="/basics5">Disabling ordering</a>
+</li>
+<li>
+<a href="/basics6">Initial conditions and ordering</a>
+</li>
+<li>
+<a href="/buttons">External submit/reset buttons</a>
+</li>
+<li>
+<a href="/detached_filters">External filters</a>
+</li>
+<li>
+<a href="/detached_filters_two_grids">External filters (example with 2 grids)</a>
+</li>
+<li>
+<a href="/no_records">A grid without records</a>
+</li>
+<li class="nav-header">Joined tables</li>
+<li>
+<a href="/joining_tables">Joined tables</a>
+</li>
+<li>
+<a href="/two_associations">2 associations to the same table</a>
+</li>
+<li class="nav-header">Custom filters and ordering</li>
+<li>
+<a href="/custom_ordering">Custom ordering</a>
+</li>
+<li>
+<a href="/custom_filters1">Custom filters (one table)</a>
+</li>
+<li>
+<a href="/custom_filters2">Custom filters (joined tables)</a>
+</li>
+<li>
+<a href="/custom_filters3">Custom filters (method chains)</a>
+</li>
+<li>
+<a href="/custom_filters4">Custom filters: turning off multiple selection</a>
+</li>
+<li>
+<a href="/null_values">Custom filters (null values)</a>
+</li>
+<li class="nav-header">Miscellaneous</li>
+<li>
+<a href="/styling">Styling the grid</a>
+</li>
+<li>
+<a href="/negation">Text filters with negation</a>
+</li>
+<li>
+<a href="/adding_rows">Adding custom rows</a>
+</li>
+<li>
+<a href="/all_records">Removing link "All Records"</a>
+</li>
+<li class="active">
+<a href="/csv_export">CSV export</a>
+</li>
+<li>
+<a href="/csv_and_detached_filters">CSV export and external filters</a>
+</li>
+<li>
+<a href="/auto_reloads">Auto reloading filters</a>
+</li>
+<li>
+<a href="/auto_reloads2">Auto reloading filters (external filters)</a>
+</li>
+<li>
+<a href="/auto_reloads3">Aut</a></li></ul></div></div></div></div></body></html>
# ./spec/features/csv_export_request_spec.rb:12:in `block (2 levels) in <top (required)>'
Finished in 4.39 seconds (files took 2.9 seconds to load)
1 example, 1 failure
Failed examples:
rspec ./spec/features/csv_export_request_spec.rb:9 # CSV export WiceGrid should export csv
[Coveralls] Outside the CI environment, not sending data.
Coverage report generated for RSpec to /Users/jasonbarnabe/wice_grid/coverage. 1422 / 2768 LOC (51.37%) covered.