Skip to content

Commit e97efb6

Browse files
authored
Merge pull request #193 from kiskoza/test-cleanup
Clean up test to make it easier to fix recent Rails versions
2 parents 0d6158f + 07f6752 commit e97efb6

File tree

82 files changed

+470
-1141
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+470
-1141
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name: Test
22
on:
33
push:
4-
branches: ['*']
4+
branches: ["*"]
55
pull_request:
6-
branches: ['*']
6+
branches: ["*"]
77

88
jobs:
99
test_ruby_and_rails_versions:
@@ -13,121 +13,26 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
rails:
16-
- "4.2"
17-
- "5.0"
18-
- "5.1"
19-
- "5.2"
20-
- "6.0"
2116
- "6.1"
2217
- "7.0"
2318
- "7.1"
2419
- "7.2"
2520

2621
ruby:
27-
- "2.4"
28-
- "2.5"
2922
- "2.6"
3023
- "2.7"
3124
- "3.0"
3225
- "3.1"
3326
- "3.2"
3427
- "3.3"
3528

36-
include:
37-
- rails: "4.2"
38-
bundler: "1.17.3"
39-
4029
exclude:
41-
- rails: "4.2"
42-
ruby: "2.7"
43-
44-
- rails: "4.2"
45-
ruby: "3.0"
46-
47-
- rails: "4.2"
48-
ruby: "3.1"
49-
50-
- rails: "4.2"
51-
ruby: "3.2"
52-
53-
- rails: "4.2"
54-
ruby: "3.3"
55-
56-
- rails: "5.0"
57-
ruby: "3.0"
58-
59-
- rails: "5.0"
60-
ruby: "3.1"
61-
62-
- rails: "5.0"
63-
ruby: "3.2"
64-
65-
- rails: "5.0"
66-
ruby: "3.3"
67-
68-
- rails: "5.1"
69-
ruby: "3.0"
70-
71-
- rails: "5.1"
72-
ruby: "3.1"
73-
74-
- rails: "5.1"
75-
ruby: "3.2"
76-
77-
- rails: "5.1"
78-
ruby: "3.3"
79-
80-
- rails: "5.2"
81-
ruby: "3.0"
82-
83-
- rails: "5.2"
84-
ruby: "3.1"
85-
86-
- rails: "5.2"
87-
ruby: "3.2"
88-
89-
- rails: "5.2"
90-
ruby: "3.3"
91-
92-
- rails: "6.0"
93-
ruby: "2.4"
94-
95-
- rails: "6.0"
96-
ruby: "3.1"
97-
98-
- rails: "6.0"
99-
ruby: "3.2"
100-
101-
- rails: "6.0"
102-
ruby: "3.3"
103-
104-
- rails: "6.1"
105-
ruby: "2.4"
106-
107-
- rails: "7.0"
108-
ruby: "2.4"
109-
110-
- rails: "7.0"
111-
ruby: "2.5"
112-
11330
- rails: "7.0"
11431
ruby: "2.6"
11532

116-
- rails: "7.1"
117-
ruby: "2.4"
118-
119-
- rails: "7.1"
120-
ruby: "2.5"
121-
12233
- rails: "7.1"
12334
ruby: "2.6"
12435

125-
- rails: "7.2"
126-
ruby: "2.4"
127-
128-
- rails: "7.2"
129-
ruby: "2.5"
130-
13136
- rails: "7.2"
13237
ruby: "2.6"
13338

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Change log
22

3+
**Unreleased**
4+
5+
- Drop support for Ruby < 2.6 and Rails < 6.1
6+
- Require at least caxlsx 4.0
7+
38
**June 18, 2024**: 0.6.4 release
49

510
- Convert to Github actions
@@ -104,4 +109,3 @@
104109

105110
- Initial posting.
106111
- It works, but there are no tests! Bad programmer!
107-

README.md

Lines changed: 3 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,9 @@ See [previous installations](#previous-installations) if needed.
3333

3434
## Requirements
3535

36-
* Tested on Rails 4.2, 5.x, 6.x, and 7.x.
37-
* For Rails 3.1 or 3.2 use version 3.0
38-
* **As of 0.5.0 requires Axlsx 2.0.1, but strongly suggests 2.1.0.pre, which requires rubyzip 1.1.0**
39-
* As of Rails 4.1 you must use `render_to_string` to render a mail attachment.
36+
* Tested on Rails 6.1, and 7.x.
37+
* Supported Ruby versions: 2.6, 2.7, 3.x
38+
* Minimum Caxlsx version: 4.0
4039

4140
## FYI
4241

@@ -443,32 +442,6 @@ form_with method: :post, url: my_named_route_path(format: :xlsx) do |f|
443442

444443
If you are having problems, try to isolate the issue. Use the console or a script to make sure your data is good. Then create the spreadsheet line by line without Axlsx-Rails to see if you are having caxlsx problems. If you can manually create the spreadsheet, create an issue and we will work it out.
445444

446-
## Previous Installations
447-
448-
In your Gemfile:
449-
450-
```ruby
451-
gem 'rubyzip', '>= 1.2.1'
452-
gem 'axlsx', git: 'https://github.com/randym/axlsx.git', ref: 'c8ac844'
453-
gem 'axlsx_rails'
454-
```
455-
456-
If `rubyzip 1.0.0` is needed:
457-
458-
```ruby
459-
gem 'rubyzip', '= 1.0.0'
460-
gem 'axlsx', '= 2.0.1'
461-
gem 'axlsx_rails'
462-
```
463-
464-
If `rubyzip >= 1.1.0` is needed:
465-
466-
```ruby
467-
gem 'rubyzip', '~> 1.1.0'
468-
gem 'axlsx', '2.1.0.pre'
469-
gem 'axlsx_rails'
470-
```
471-
472445
## Dependencies
473446

474447
- [Rails](https://github.com/rails/rails)
@@ -493,110 +466,3 @@ Many thanks to [contributors](https://github.com/caxlsx/caxlsx_rails/graphs/cont
493466
* [kodram](https://github.com/kodram)
494467
* [JohnSmall](https://github.com/JohnSmall)
495468
* [BenoitHiller](https://github.com/BenoitHiller)
496-
497-
## Change log
498-
499-
**June 18, 2024**: 0.6.4 release
500-
501-
- Convert to Github actions
502-
- Improve tests
503-
- Fix broken templates with comments as their last line
504-
505-
**March 8, 2022**: 0.6.3 release
506-
507-
- Exclude rspec directory (#149)[https://github.com/caxlsx/caxlsx_rails/pull/149]
508-
509-
**December 18, 2019**: 0.6.2 release
510-
511-
- Release under caxlsx_rails
512-
513-
**December 18, 2019**: 0.6.1 release
514-
515-
- Deprecate axlsx_rails name, release under caxlsx_rails
516-
- Switch to using caxlsx 3.0 gem
517-
518-
**September 5, 2019**: 0.6.0 release
519-
520-
- Improved Rails 6.0 compatibility re MIME type
521-
522-
**May 1st, 2018**: 0.5.2 release
523-
524-
- Improved Rails 5 compatibility re MIME type
525-
526-
**March 29th, 2017**: 0.5.1 release
527-
528-
- Fix stack trace line numbers
529-
- Thanks to [BenoitHiller](https://github.com/BenoitHiller)
530-
531-
**July 26st, 2016**: 0.5.0 release
532-
533-
- Support for Rails 5
534-
- **Tested on on Rails 4.0, 4.1, 4.2, and 5.0**
535-
- Bug fixes for unreadable files and UTF-8 errors
536-
537-
**July 13th, 2015**: 0.4.0 release
538-
539-
- Support for Rails 4.2
540-
- **Removal of forced default_formats** (url format must match)
541-
- **Tested only on Rails 4.1 and 4.2**
542-
- **For Rails 3.2 or below, use 0.3.0**
543-
544-
**November 20th, 2014**: 0.3.0 release
545-
546-
- Support for Rails 4.2.beta4.
547-
- **Removal of shorthand template syntax** (`render xlsx: 'another/directory'`)
548-
549-
**September 4, 2014**: 0.2.1 release
550-
551-
- Rails 4.2.beta1 no longer includes responder. This release checks for the existence of responder before configuring a default responder.
552-
- Rails 4.2 testing, though not yet on Travis CI
553-
- Author, created_at, and use_shared_strings parameters for Axlsx::Package.new
554-
555-
**April 9, 2014**: 0.2.0 release
556-
557-
- Require Axlsx 2.0.1, which requires rubyzip 1.0.0
558-
- Better render handling and testing, which might break former usage
559-
- Rails 4.1 testing
560-
- Mailer example update (**use render_to_string not render**)
561-
562-
**October 11, 2013**
563-
564-
- Handle (and test) respond_to override
565-
566-
**October 4, 2013**
567-
568-
- Added coveralls
569-
- Raised testing to axlsx 2.0.1, roo 1.12.2, and rubyzip 1.0.0
570-
571-
**July 25, 2013**
572-
573-
- Documentation improved
574-
- Testing for generating partial in mailer
575-
576-
**January 18, 2013**: 0.1.4 release
577-
578-
- Now supports Rails 4 (thanks [Envek](https://github.com/Envek))
579-
- If you call render :xlsx on a request without :xlsx format, it should force the :xlsx format. Works on Rails 3.2+.
580-
581-
**December 6, 2012**: 0.1.3 release
582-
583-
- Fix for absolute template paths
584-
585-
**July 25, 2012**: 0.1.2 release
586-
587-
- Partials tested
588-
589-
**July 19, 2012**: 0.1.1 release
590-
591-
- Travis-ci added (thanks [randym](https://github.com/randym))
592-
- render statements and filename tests fixes (thanks [engwan](https://github.com/engwan))
593-
594-
**July 17, 2012**: 0.1.0 release
595-
596-
- Tests completed
597-
- Acts_as_xlsx tested, example in docs
598-
599-
**July 12, 2012**: 0.0.1 release
600-
601-
- Initial posting.
602-
- It works, but there are no tests! Bad programmer!

caxlsx_rails.gemspec

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,15 @@ Gem::Specification.new do |s|
1919

2020
s.files = Dir['lib/**/*', 'CHANGELOG.md', 'README.md', 'MIT-LICENSE', 'caxlsx_rails.gemspec']
2121

22-
s.add_dependency 'actionpack', '>= 3.1'
23-
s.add_dependency 'caxlsx', '>= 3.0'
22+
s.add_dependency 'actionpack', '>= 6.1'
23+
s.add_dependency 'caxlsx', '>= 4.0'
2424

2525
s.add_development_dependency 'bundler'
2626
s.add_development_dependency 'rake'
2727
s.add_development_dependency 'rspec-rails'
28-
s.add_development_dependency 'guard-rspec'
2928
s.add_development_dependency 'capybara'
3029
s.add_development_dependency 'roo'
3130
s.add_development_dependency 'rubyzip'
32-
s.add_development_dependency 'growl'
33-
s.add_development_dependency 'rb-fsevent'
34-
s.add_development_dependency 'coveralls'
35-
s.add_development_dependency 'pry'
36-
s.add_development_dependency 'pry-nav'
31+
32+
s.required_ruby_version = '>= 2.6'
3733
end

lib/axlsx_rails.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
warn "DEPRECATION WARNING: axlsx_rails has been renamed to caxlsx_rails. See http://github.com/caxlsx"
44

5-
require 'axlsx_rails/railtie' if defined?(Rails)
5+
require 'caxlsx_rails'

lib/axlsx_rails/action_controller.rb

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,8 @@
22

33
require 'action_controller'
44

5-
if Rails.version.to_f >= 5
6-
unless Mime[:xlsx]
7-
Mime::Type.register 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', :xlsx
8-
end
9-
else
10-
unless defined? Mime::XLSX
11-
Mime::Type.register 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', :xlsx
12-
end
5+
unless Mime[:xlsx]
6+
Mime::Type.register 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', :xlsx
137
end
148

159
ActionController::Renderers.add :xlsx do |filename, options|
@@ -19,7 +13,7 @@
1913
# def called_action
2014
# render xlsx: 'filename', template: 'controller/diff_action'
2115
# end
22-
#
16+
#
2317
# And the normal use case works:
2418
#
2519
# def called_action
@@ -46,15 +40,11 @@
4640
options[:locals][:xlsx_use_shared_strings] = options.delete(:xlsx_use_shared_strings)
4741
end
4842

49-
mime = Rails.version.to_f >= 5 ? Mime[:xlsx] : Mime::XLSX
50-
send_data render_to_string(options), filename: file_name, type: mime, disposition: disposition
43+
send_data render_to_string(options), filename: file_name, type: Mime[:xlsx], disposition: disposition
5144
end
5245

5346
# For respond_to default
54-
begin
55-
ActionController::Responder
56-
rescue
57-
else
47+
if defined?(ActionController::Responder)
5848
class ActionController::Responder
5949
def to_xlsx
6050
@_action_has_layout = false

0 commit comments

Comments
 (0)