-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix tests and deprecations for Rails v6 to v7.
- Loading branch information
1 parent
8cf317b
commit ac6146d
Showing
32 changed files
with
598 additions
and
498 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,15 @@ | ||
|
||
appraise 'rails-v5.1.x' do | ||
gem 'rails', '~> 5.1.0' | ||
# https://github.com/rails/rails/issues/29031 | ||
gem 'minitest', '5.10.1' | ||
end | ||
|
||
appraise 'rails-v5.2.x' do | ||
gem 'rails', '~> 5.2.0' | ||
appraise 'rails_v6.0.x' do | ||
gem 'rails', '~> 6.0.0' | ||
gem 'minitest' | ||
end | ||
|
||
appraise 'rails_v6.0.x' do | ||
gem 'rails', '~> 6.0.0' | ||
appraise 'rails_v6.1.x' do | ||
gem 'rails', '~> 6.1.0' | ||
gem 'minitest' | ||
end | ||
|
||
appraise 'rails_v7.0.x' do | ||
gem 'rails', '~> 7.0.0.alpha2' | ||
gem 'rails', '~> 7.0.0' | ||
gem 'minitest' | ||
gem 'view_component', require: 'view_component/engine' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,7 +63,7 @@ This <a href="https://chriskottom.com/freebies/cheatsheets_free.pdf">cheat sheet | |
assert_equal 100, foo | ||
|
||
# MiniTest::Spec Assertion Style: | ||
foo.must_equal 100 | ||
expect(foo).must_equal 100 | ||
``` | ||
|
||
|
||
|
@@ -72,7 +72,7 @@ require 'test_helper' | |
class UserTest < ActiveSupport::TestCase | ||
let(:user_ken) { User.create! :email => '[email protected]' } | ||
it 'works' do | ||
user_ken.must_be_instance_of User | ||
expect(user_ken).must_be_instance_of User | ||
end | ||
end | ||
``` | ||
|
@@ -152,9 +152,9 @@ class ActiveSupportCallbackTest < ActiveSupport::TestCase | |
before { @bat = 'biz' } | ||
|
||
it 'works' do | ||
@foo.must_equal 'foo' | ||
@bar.must_equal 'bar' | ||
@bat.must_equal 'biz' | ||
expect(@foo).must_equal 'foo' | ||
expect(@bar).must_equal 'bar' | ||
expect(@bat).must_equal 'biz' | ||
end | ||
|
||
private | ||
|
@@ -194,11 +194,11 @@ end | |
If you prefer the assertions provided by shoulda-context like `assert_same_elements`, then you may want to consider copying them [from here](https://github.com/thoughtbot/shoulda-context/blob/master/lib/shoulda/context/assertions.rb) and including them in `MiniTest::Spec` yourself. I personally recommend just replacing these assertions with something more modern. A few examples are below. | ||
|
||
```ruby | ||
assert_same_elements a, b # From | ||
a.sort.must_equal b.sort # To | ||
assert_same_elements a, b # From | ||
expect(a.sort).must_equal b.sort # To | ||
|
||
assert_does_not_contain a, b # From | ||
a.wont_include b # To | ||
expect(a).wont_include b # To | ||
``` | ||
|
||
### Matchers | ||
|
@@ -274,9 +274,9 @@ $ bundle exec appraisal rake test | |
We use the [appraisal](https://github.com/thoughtbot/appraisal) gem from Thoughtbot to help us generate the individual gemfiles for each Rails version and to run the tests locally against each generated Gemfile. The `rake appraisal test` command actually runs our test suite against all Rails versions in our `Appraisal` file. If you want to run the tests for a specific Rails version, use `bundle exec appraisal -h` for a list. For example, the following command will run the tests for Rails 4.1 only. | ||
|
||
```shell | ||
$ bundle exec appraisal rails-v5.1.x rake test | ||
$ bundle exec appraisal rails-v5.2.x rake test | ||
$ bundle exec appraisal rails-v6.0.x rake test | ||
$ bundle exec appraisal rails_v6.0.x rake test | ||
$ bundle exec appraisal rails_v6.1.x rake test | ||
$ bundle exec appraisal rails_v7.0.x rake test | ||
``` | ||
|
||
We have a few branches for each major Rails version. | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.