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

Gems updated resolving deprecation warnings #424

Merged
merged 4 commits into from
Nov 21, 2017

Conversation

reconstructions
Copy link
Contributor

@reconstructions reconstructions commented Nov 20, 2017

Gems and syntax were updated to remove deprecation warnings in RSpec and Mocha, fix ActionCable, and migrate to the latest versions. The rails_best_practices Gem was added and slightly improved some of the Rails code quality.

RSpec Deprecation Warnings:

The following warning was thrown after every test when using database_cleaner version 1.5.3:

DEPRECATION WARNING: schema_migrations_table_name is deprecated and will be removed from Rails 5.2 (called from block (2 levels) in <top (required)> at …

Updating the gem to database_cleaner 1.6.2 fixed this.

FactoryGirl threw the following warning when running RSpec tests:

DEPRECATION WARNING: The factory_girl gem is deprecated. Please upgrade to factory_bot. See https://github.com/thoughtbot/factory_bot/blob/v4.9.0/UPGRADE_FROM_FACTORY_GIRL.md for further instructions. (called from <top (required)> at …

This was fixed by replacing factory_girl_rails with the factory_bot_rails gem.

Mocha Deprecation Warnings:

The syntax of client/package.json line 29 resulted in the following
warning:

(node:99289) DeprecationWarning: "--compilers" will be removed in a future version of Mocha; see https://git.io/vdcSr for more info

Revisions fixed this.

Action Cable Broken:

Action Cable was failing with the following error in the dev server logs:

ERROR -- Specified 'redis' for Action Cable pubsub adapter, but the gem is not loaded. Add `gem 'redis'` to your Gemfile (and ensure its version is at the minimum required by Action Cable).: nil

As described in this rails issue, this was fixed by rolling the redis gem back to version 3.3.3.

Gems Updated:

Most other Gems were also updated. Updating RSpec to version 3.7.1 caused the following test failures:

1) Git Commit SHA when .source_version file does not exist behaves like Git Commit SHA displays the current git commit
     Failure/Error: expect(el.text).to eq expected_text

       expected: "5eead5x"
            got: "1eadebc"

2) Git Commit SHA when .source_version file exists behaves like Git Commit SHA displays the current git commit
     Failure/Error: expect(el.text).to eq expected_text

       expected: "5eead5y"
            got: "1eadebc"

3) Destroy a comment from classic page clicking destroy link destroys comment
     Failure/Error:
       accept_confirm do
         click_link "Destroy", href: comment_path(comment)
       end

     NoMethodError:
       undefined method `[]' for nil:NilClass

Rolling back to rspec-rails 3.6.1 resolved errors one and two, which might be related to RSpec’s version 3.7 mocks.

Error three appeared to result from Capybara’s accept_confirm method not being found. This was fixed by upgrading capybara-webkit to version 1.14.0 and selenium-webdriver to version 3.7.0

rails_best_practices

The following code quality issues were flagged by this gem:

/Users/reconstructions/Desktop/Coding_2013/Rails_Apps/react-webpack-rails-tutorial/app/helpers/comments_helper.rb:1 - remove empty helpers
/Users/reconstructions/Desktop/Coding_2013/Rails_Apps/react-webpack-rails-tutorial/app/models/git_commit_sha.rb:11 - remove unused methods (GitCommitSha#reset_current_sha)
/Users/reconstructions/Desktop/Coding_2013/Rails_Apps/react-webpack-rails-tutorial/app/views/comments/_form.html.erb:1 - replace instance variable with local variable
/Users/reconstructions/Desktop/Coding_2013/Rails_Apps/react-webpack-rails-tutorial/app/views/comments/_form.html.erb:2 - replace instance variable with local variable
/Users/reconstructions/Desktop/Coding_2013/Rails_Apps/react-webpack-rails-tutorial/app/views/comments/_form.html.erb:4 - replace instance variable with local variable
/Users/reconstructions/Desktop/Coding_2013/Rails_Apps/react-webpack-rails-tutorial/app/views/comments/_form.html.erb:7 - replace instance variable with local variable

The instance variable issues were revised, a rake task was added to run rails_best_practices, and this issue:

/Users/reconstructions/Desktop/Coding_2013/Rails_Apps/react-webpack-rails-tutorial/app/models/git_commit_sha.rb:11 - remove unused methods (GitCommitSha#reset_current_sha)

Was left as-is with the config/rails_best_practices.yml set up so that it wouldn't appear when running the Gem.

In a future pull request I could move this method to the spec/support directory, since it seems to be used only in the test suite, if desirable.


This change is Reviewable

@reconstructions reconstructions changed the title Gems Updated Resolving Deprecation Warnings Gems updated resolving deprecation warnings Nov 20, 2017
@reconstructions
Copy link
Contributor Author

reconstructions commented Nov 21, 2017

Saw the travis build failed with:

Downloading capybara-webkit-1.14.0 revealed dependencies not in the API or the
lockfile (capybara (< 2.14.0, >= 2.3.0)).
Either installing with `--full-index` or running `bundle update capybara-webkit`
should fix the problem.

The capybara gem is at 2.16.0 in Gemfile.lock. Running bundle update capybara-webkit locally regresses that gem from 1.14.0 to 1.1.0. I didn't see any errors bundling locally, I will roll capybara back to 2.13.0, and if that works with no errors, I will add more commits.

@reconstructions
Copy link
Contributor Author

reconstructions commented Nov 21, 2017

Looks like the Gemset bundled fine using my most recent commit, but the build failed because of Node v9. There is an issue about this.

@justin808
Copy link
Member

This looks solid. @Judahmeek thoughts?

@justin808 justin808 merged commit 5fc543e into shakacode:master Nov 21, 2017
@justin808
Copy link
Member

Thanks @reconstructions!

@reconstructions
Copy link
Contributor Author

No worries, it's the least I can do considering how awesome this is, how I can contribute more...

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

Successfully merging this pull request may close these issues.

2 participants