Skip to content

Commit c612bb6

Browse files
authored
Merge pull request #563 from lcreid/master
Update supported Ruby and Rails versions
2 parents 9ae52df + 33ce391 commit c612bb6

File tree

11 files changed

+46
-96
lines changed

11 files changed

+46
-96
lines changed

.rubocop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ require: rubocop-rails
55
AllCops:
66
DisplayCopNames: true
77
DisplayStyleGuide: true
8-
TargetRubyVersion: 2.3
8+
TargetRubyVersion: 2.5
99
Exclude:
1010
- "bin/*"
1111
- Capfile

.travis.yml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
language: ruby
22
rvm:
3-
- 2.7
3+
- 2.7.1
44
- 2.6.5
55
- 2.5.7
6-
- 2.4.9
76
gemfile:
8-
- gemfiles/5.0.gemfile
9-
- gemfiles/5.1.gemfile
107
- gemfiles/5.2.gemfile
118
- gemfiles/6.0.gemfile
129
cache:
@@ -15,21 +12,17 @@ script:
1512
- bundle exec rake test
1613

1714
matrix:
18-
exclude:
19-
- rvm: 2.4.9
20-
gemfile: gemfiles/6.0.gemfile
21-
2215
include:
2316
# Bleeding edge Ruby
2417
- rvm: ruby-head
2518
gemfile: gemfiles/6.0.gemfile
2619

2720
# Next version of Rails
28-
- rvm: 2.5.7
21+
- rvm: 2.7.1
2922
gemfile: gemfiles/edge.gemfile
3023

3124
# Running one job to execute DANGER bot and linting
32-
- rvm: 2.5.7
25+
- rvm: 2.7.1
3326
gemfile: gemfiles/6.0.gemfile
3427
script:
3528
- gem install danger
@@ -38,5 +31,5 @@ matrix:
3831

3932
allow_failures:
4033
- rvm: ruby-head
41-
- rvm: 2.5.7
34+
- rvm: 2.7.1
4235
gemfile: gemfiles/edge.gemfile

Gemfile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,13 @@ group :development do
1111
gem "htmlbeautifier"
1212
gem "rubocop-rails", require: false
1313
gem "sassc-rails"
14-
gem "webpacker", ">= 4.0.0.rc.3"
14+
gem "webpacker"
1515
end
1616

1717
group :test do
1818
# can relax version requirement for Rails 5.2.beta3+
19-
gem "minitest", "~> 5.10.3"
20-
2119
gem "diffy"
2220
gem "equivalent-xml"
2321
gem "mocha"
2422
gem "sqlite3"
25-
gem "timecop", "~> 0.7.1"
2623
end

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ Some other nice things that `bootstrap_form` does for you are:
3131

3232
`bootstrap_form` supports at a minimum the currently supported versions of Ruby and Rails:
3333

34-
* Ruby 2.4+
35-
* Rails 5.0+ (Rails 5.1+ for `bootstrap_form_with`)
34+
* Ruby 2.5+
35+
* Rails 5.2+
3636
* Bootstrap 4.0+
3737

3838
## Installation
@@ -107,7 +107,7 @@ If your form is not backed by a model, use the `bootstrap_form_tag`. Usage of th
107107
<% end %>
108108
```
109109

110-
### bootstrap_form_with (Rails 5.1+)
110+
### bootstrap_form_with
111111

112112
Note that `form_with` in Rails 5.1 does not add IDs to form elements and labels by default, which are both important to Bootstrap markup. This behaviour is corrected in Rails 5.2.
113113

bootstrap_form.gemspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ Gem::Specification.new do |s|
2424
s.bindir = "exe"
2525
s.require_paths = ["lib"]
2626

27-
s.required_ruby_version = ">= 2.3"
27+
s.required_ruby_version = ">= 2.5"
2828

29-
s.add_dependency("actionpack", ">= 5.0")
30-
s.add_dependency("activemodel", ">= 5.0")
29+
s.add_dependency("actionpack", ">= 5.2")
30+
s.add_dependency("activemodel", ">= 5.2")
3131
end

gemfiles/5.0.gemfile

Lines changed: 0 additions & 18 deletions
This file was deleted.

gemfiles/5.1.gemfile

Lines changed: 0 additions & 17 deletions
This file was deleted.

test/bootstrap_configuration_test.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ class BootstrapConfigurationTest < ActionView::TestCase
1818
config = BootstrapForm::Configuration.new
1919
config.default_form_attributes = nil
2020

21-
assert_equal({ }, config.default_form_attributes)
21+
assert_equal({}, config.default_form_attributes)
2222
end
2323

2424
test "does not allow to set default_form_attributes with unsupported value" do
2525
config = BootstrapForm::Configuration.new
2626

2727
exception = assert_raises ArgumentError do
28-
config.default_form_attributes = [1,2,3]
28+
config.default_form_attributes = [1, 2, 3]
2929
end
30-
assert_equal('Unsupported default_form_attributes [1, 2, 3]', exception.message)
30+
assert_equal("Unsupported default_form_attributes [1, 2, 3]", exception.message)
3131
end
3232
end

test/bootstrap_form_test.rb

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -456,13 +456,12 @@ class BootstrapFormTest < ActionView::TestCase
456456
end
457457

458458
test "label error messages use humanized attribute names" do
459-
begin
460-
I18n.backend.store_translations(:en, activerecord: { attributes: { user: { email: "Your e-mail address" } } })
459+
I18n.backend.store_translations(:en, activerecord: { attributes: { user: { email: "Your e-mail address" } } })
461460

462-
@user.email = nil
463-
assert @user.invalid?
461+
@user.email = nil
462+
assert @user.invalid?
464463

465-
expected = <<-HTML.strip_heredoc
464+
expected = <<-HTML.strip_heredoc
466465
<form accept-charset="UTF-8" action="/users" class="new_user" id="new_user" method="post" role="form">
467466
#{'<input name="utf8" type="hidden" value="&#x2713;"/>' unless ::Rails::VERSION::STRING >= '6'}
468467
<div class="form-group">
@@ -471,11 +470,10 @@ class BootstrapFormTest < ActionView::TestCase
471470
<div class="invalid-feedback">can't be blank, is too short (minimum is 5 characters)</div>
472471
</div>
473472
</form>
474-
HTML
475-
assert_equivalent_xml expected, bootstrap_form_for(@user, label_errors: true, inline_errors: true) { |f| f.text_field :email }
476-
ensure
477-
I18n.backend.store_translations(:en, activerecord: { attributes: { user: { email: nil } } })
478-
end
473+
HTML
474+
assert_equivalent_xml expected, bootstrap_form_for(@user, label_errors: true, inline_errors: true) { |f| f.text_field :email }
475+
ensure
476+
I18n.backend.store_translations(:en, activerecord: { attributes: { user: { email: nil } } })
479477
end
480478

481479
test "alert message is wrapped correctly" do
@@ -759,14 +757,13 @@ class BootstrapFormTest < ActionView::TestCase
759757
end
760758

761759
test "help translations do not escape HTML when _html is appended to the name" do
762-
begin
763-
I18n.backend.store_translations(:en, activerecord: { help: { user: { email_html: "This is <strong>useful</strong> help" } } })
760+
I18n.backend.store_translations(:en, activerecord: { help: { user: { email_html: "This is <strong>useful</strong> help" } } })
764761

765-
output = bootstrap_form_for(@user) do |f|
766-
f.text_field(:email)
767-
end
762+
output = bootstrap_form_for(@user) do |f|
763+
f.text_field(:email)
764+
end
768765

769-
expected = <<-HTML.strip_heredoc
766+
expected = <<-HTML.strip_heredoc
770767
<form accept-charset="UTF-8" action="/users" class="new_user" id="new_user" method="post" role="form">
771768
#{'<input name="utf8" type="hidden" value="&#x2713;"/>' unless ::Rails::VERSION::STRING >= '6'}
772769
<div class="form-group">
@@ -775,11 +772,10 @@ class BootstrapFormTest < ActionView::TestCase
775772
<small class="form-text text-muted">This is <strong>useful</strong> help</small>
776773
</div>
777774
</form>
778-
HTML
779-
assert_equivalent_xml expected, output
780-
ensure
781-
I18n.backend.store_translations(:en, activerecord: { help: { user: { email_html: nil } } })
782-
end
775+
HTML
776+
assert_equivalent_xml expected, output
777+
ensure
778+
I18n.backend.store_translations(:en, activerecord: { help: { user: { email_html: nil } } })
783779
end
784780

785781
test "allows the form object to be nil" do

test/bootstrap_selects_test.rb

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ def options_range(start: 1, stop: 31, selected: nil, months: false)
294294
end
295295

296296
test "date selects are wrapped correctly" do
297-
Timecop.freeze(Time.utc(2012, 2, 3)) do
297+
travel_to(Time.utc(2012, 2, 3)) do
298298
expected = <<-HTML.strip_heredoc
299299
<div class="form-group">
300300
<label for="user_misc">Misc</label>
@@ -316,7 +316,7 @@ def options_range(start: 1, stop: 31, selected: nil, months: false)
316316
end
317317

318318
test "date selects are wrapped correctly with wrapper class" do
319-
Timecop.freeze(Time.utc(2012, 2, 3)) do
319+
travel_to(Time.utc(2012, 2, 3)) do
320320
expected = <<-HTML.strip_heredoc
321321
<div class="form-group none-margin">
322322
<label for="user_misc">Misc</label>
@@ -338,7 +338,7 @@ def options_range(start: 1, stop: 31, selected: nil, months: false)
338338
end
339339

340340
test "date selects inline when layout is horizontal" do
341-
Timecop.freeze(Time.utc(2012, 2, 3)) do
341+
travel_to(Time.utc(2012, 2, 3)) do
342342
expected = <<-HTML.strip_heredoc
343343
<form accept-charset="UTF-8" action="/users" class="new_user" id="new_user" method="post" role="form">
344344
#{'<input name="utf8" type="hidden" value="&#x2713;"/>' unless ::Rails::VERSION::STRING >= '6'}
@@ -366,7 +366,7 @@ def options_range(start: 1, stop: 31, selected: nil, months: false)
366366

367367
test "date selects are wrapped correctly with error" do
368368
@user.errors.add(:misc, "error for test")
369-
Timecop.freeze(Time.utc(2012, 2, 3)) do
369+
travel_to(Time.utc(2012, 2, 3)) do
370370
expected = <<-HTML.strip_heredoc
371371
<form accept-charset="UTF-8" action="/users" class="new_user" id="new_user" method="post" role="form">
372372
#{'<input name="utf8" type="hidden" value="&#x2713;"/>' unless ::Rails::VERSION::STRING >= '6'}
@@ -392,7 +392,7 @@ def options_range(start: 1, stop: 31, selected: nil, months: false)
392392
end
393393

394394
test "date selects with options are wrapped correctly" do
395-
Timecop.freeze(Time.utc(2012, 2, 3)) do
395+
travel_to(Time.utc(2012, 2, 3)) do
396396
expected = <<-HTML.strip_heredoc
397397
<div class="form-group">
398398
<label for="user_misc">Misc</label>
@@ -418,7 +418,7 @@ def options_range(start: 1, stop: 31, selected: nil, months: false)
418418
end
419419

420420
test "date selects with options and html_options are wrapped correctly" do
421-
Timecop.freeze(Time.utc(2012, 2, 3)) do
421+
travel_to(Time.utc(2012, 2, 3)) do
422422
expected = <<-HTML.strip_heredoc
423423
<div class="form-group">
424424
<label for="user_misc">Misc</label>
@@ -443,7 +443,7 @@ def options_range(start: 1, stop: 31, selected: nil, months: false)
443443
end
444444

445445
test "time selects are wrapped correctly" do
446-
Timecop.freeze(Time.utc(2012, 2, 3, 12, 0, 0)) do
446+
travel_to(Time.utc(2012, 2, 3, 12, 0, 0)) do
447447
expected = <<-HTML.strip_heredoc
448448
<div class="form-group">
449449
<label for="user_misc">Misc</label>
@@ -467,7 +467,7 @@ def options_range(start: 1, stop: 31, selected: nil, months: false)
467467

468468
test "time selects are wrapped correctly with error" do
469469
@user.errors.add(:misc, "error for test")
470-
Timecop.freeze(Time.utc(2012, 2, 3, 12, 0, 0)) do
470+
travel_to(Time.utc(2012, 2, 3, 12, 0, 0)) do
471471
expected = <<-HTML.strip_heredoc
472472
<form accept-charset="UTF-8" action="/users" class="new_user" id="new_user" method="post" role="form">
473473
#{'<input name="utf8" type="hidden" value="&#x2713;"/>' unless ::Rails::VERSION::STRING >= '6'}
@@ -494,7 +494,7 @@ def options_range(start: 1, stop: 31, selected: nil, months: false)
494494
end
495495

496496
test "time selects with options are wrapped correctly" do
497-
Timecop.freeze(Time.utc(2012, 2, 3, 12, 0, 0)) do
497+
travel_to(Time.utc(2012, 2, 3, 12, 0, 0)) do
498498
expected = <<-HTML.strip_heredoc
499499
<div class="form-group">
500500
<label for="user_misc">Misc</label>
@@ -519,7 +519,7 @@ def options_range(start: 1, stop: 31, selected: nil, months: false)
519519
end
520520

521521
test "time selects with options and html_options are wrapped correctly" do
522-
Timecop.freeze(Time.utc(2012, 2, 3, 12, 0, 0)) do
522+
travel_to(Time.utc(2012, 2, 3, 12, 0, 0)) do
523523
expected = <<-HTML.strip_heredoc
524524
<div class="form-group">
525525
<label for="user_misc">Misc</label>
@@ -544,7 +544,7 @@ def options_range(start: 1, stop: 31, selected: nil, months: false)
544544
end
545545

546546
test "datetime selects are wrapped correctly" do
547-
Timecop.freeze(Time.utc(2012, 2, 3, 12, 0, 0)) do
547+
travel_to(Time.utc(2012, 2, 3, 12, 0, 0)) do
548548
expected = <<-HTML.strip_heredoc
549549
<div class="form-group">
550550
<label for="user_misc">Misc</label>
@@ -575,7 +575,7 @@ def options_range(start: 1, stop: 31, selected: nil, months: false)
575575

576576
test "datetime selects are wrapped correctly with error" do
577577
@user.errors.add(:misc, "error for test")
578-
Timecop.freeze(Time.utc(2012, 2, 3, 12, 0, 0)) do
578+
travel_to(Time.utc(2012, 2, 3, 12, 0, 0)) do
579579
expected = <<-HTML.strip_heredoc
580580
<form accept-charset="UTF-8" action="/users" class="new_user" id="new_user" method="post" role="form">
581581
#{'<input name="utf8" type="hidden" value="&#x2713;"/>' unless ::Rails::VERSION::STRING >= '6'}
@@ -609,7 +609,7 @@ def options_range(start: 1, stop: 31, selected: nil, months: false)
609609
end
610610

611611
test "datetime selects with options are wrapped correctly" do
612-
Timecop.freeze(Time.utc(2012, 2, 3, 12, 0, 0)) do
612+
travel_to(Time.utc(2012, 2, 3, 12, 0, 0)) do
613613
expected = <<-HTML.strip_heredoc
614614
<div class="form-group">
615615
<label for="user_misc">Misc</label>
@@ -644,7 +644,7 @@ def options_range(start: 1, stop: 31, selected: nil, months: false)
644644
end
645645

646646
test "datetime selects with options and html_options are wrapped correctly" do
647-
Timecop.freeze(Time.utc(2012, 2, 3, 12, 0, 0)) do
647+
travel_to(Time.utc(2012, 2, 3, 12, 0, 0)) do
648648
expected = <<-HTML.strip_heredoc
649649
<div class="form-group">
650650
<label for="user_misc">Misc</label>

0 commit comments

Comments
 (0)