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

Fix deprecation warnings #26

Merged
merged 20 commits into from
Mar 21, 2018
Merged

Conversation

olbrich
Copy link
Contributor

@olbrich olbrich commented Mar 21, 2018

This branch does the following:

  • adds formalized testing framework for testing against rails 4.2 and 5.1 to help with ensuring backwards compatibility
  • refactors the PasswordArchiveable module to deal with changes in the rails dirty attribute handling in rails 5.1
  • Cleans up tests a bit
  • makes the test harness user include all of the various devise modules so we can check for interactions
  • updates supported ruby versions
  • adds some debugging tools and configurations to better expose deprecation warnings.

fixes #22

…some cases). It's optional and only used by us for testing, so it doesn't show up in the gemspec
…to make sure the created fixtures are valid with all the rules enforced
…ere indirectly saving a user (by saving a dependent object) would trigger an activesupport deprecation warning.
…lly simplify the logic. Also adds a compatibility module to deal with API changes in the rails dirty attribute handling
… API for testing changed between 4.2 and 5.0
@coveralls
Copy link
Collaborator

coveralls commented Mar 21, 2018

Pull Request Test Coverage Report for Build 63

  • 120 of 127 (94.49%) changed or added relevant lines in 19 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.8%) to 89.394%

Changes Missing Coverage Covered Lines Changed/Added Lines %
lib/devise-security/models/compatibility.rb 9 11 81.82%
lib/devise-security/schema.rb 1 3 33.33%
lib/devise-security/models/password_archivable.rb 19 22 86.36%
Files with Coverage Reduction New Missed Lines %
lib/devise-security/models/password_archivable.rb 1 89.74%
Totals Coverage Status
Change from base Build 59: -0.8%
Covered Lines: 767
Relevant Lines: 858

💛 - Coveralls

Copy link
Contributor

@natebird natebird left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great pull request. Thank you for your work. Because there are so many changes I'd like to have @oniofchaos look at it as well before merging.

@@ -24,4 +24,10 @@
I18n.enforce_available_locales = false

config.active_support.test_order = :sorted
config.log_level = :debug
if Rails.version < '5'
# TODO: this needs to be addressed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What needs to be addressed here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I don't set this config in rails 4.2, it will raise a deprecation warning. I'm not entirely sure there is more to do here or if that warning is just intended to warn people about about a change in behavior.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think a TODO here is appropriate, as there's nothing to fix. Instead, a comment explaining why this is needed for older Rails would be good.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was more of a reminder to myself that I forgot to remove.

Copy link
Contributor

@dillonwelch dillonwelch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the test suite is bombing out?

@@ -37,3 +37,4 @@ log
test/tmp/*
*.gem
Gemfile.lock
*.lock
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this for?

Copy link
Contributor Author

@olbrich olbrich Mar 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Appraisal generates Gemfiles in the /gemfiles directory. We don't want to check in their lock files. The same way you don't check in Gemfile.lock files

@@ -0,0 +1,22 @@
module Devise
module Models
module Compatibility
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

module PasswordArchivable
extend ActiveSupport::Concern
include Devise::Models::DatabaseAuthenticatable
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you alphabetize these?

@@ -24,4 +24,10 @@
I18n.enforce_available_locales = false

config.active_support.test_order = :sorted
config.log_level = :debug
if Rails.version < '5'
# TODO: this needs to be addressed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think a TODO here is appropriate, as there's nothing to fix. Instead, a comment explaining why this is needed for older Rails would be good.

@natebird
Copy link
Contributor

@olbrich Looks good. Thank you!

I'll just note here that the test coverage only decreased because of the refactoring of the migration code. We should probably exclude some of those files in the future.

@natebird natebird merged commit 1efd42d into devise-security:master Mar 21, 2018
@olbrich olbrich added this to the v0.12.0 milestone Mar 22, 2018
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.

RSpec deprecation warning message
4 participants