-
-
Notifications
You must be signed in to change notification settings - Fork 910
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
Deprecation for ruby 2.4 removed #1040
Conversation
The protected_attributes gem is not compatible for Rails 5, and we don't need it anyway with Strong Parameters.
Create initial environment for Rails 5
Fix #tables deprecation in Rails 5.0 - Fixes thoughtbot#933
Add Rails 5 documentation in rails-5 branch
…ions Add ruby 2.4 support to TravisCI
…ation Replace Fixnum with Integer
Remove TravisCI support for Ruby 2.0 and 2.1 Merge Appraisal Gemfiles for different Ruby versions Remove unused variable in Appraisals file
…recated-ruby-and-rails-versions Drop support for deprecated Ruby (2.0 and 2.1) and Rails (4.0 and 4.1) versions
…-versions Update Ruby versions to 2.2.7 and 2.3.4 in TravisCI
…_type' in Rails 5 This patch is based on the discussed held in issue thoughtbot#913, and a solution that I've proposed and others have confirmed as good to go 👏. Ref: thoughtbot#913 (comment)
The `delegate_method` matcher uses Doublespeak internally to do its job. The delegate object is completely stubbed using an ObjectDouble, available from Doublespeak, which is shoulda-matchers's own test double library. ObjectDouble is a class that responds to every method by implementing `method_missing`. Say you are using Ruby 2.4 and you are testing a class that uses the Forwardable module to do some delegation, and you are using `delegate_method` in your test. When you run your test you will a warning that looks something like: Courier#deliver at ~/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/forwardable.rb:156 forwarding to private method #deliver Why is this happening? When the code in your class gets exercised, Forwardable will delegate the delegate method in question to ObjectDouble, and the method will get intercepted by its `method_missing` method. The fact that this is actually a private method is what Forwardable is complaining about. To fix this, all we need to do is add `respond_to_missing?` in addition to `method_missing?`. This is explained here: https://bugs.ruby-lang.org/issues/13326
@@ -548,7 +548,7 @@ def value_to_attribute_type(value) | |||
case value | |||
when true, false then :boolean | |||
when BigDecimal then :decimal | |||
when Fixnum then :fixnum | |||
when Integer then :integer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indent when as deep as case.
@@ -538,7 +538,7 @@ def attribute_column | |||
|
|||
def column_type_to_attribute_type(type) | |||
case type | |||
when :integer, :float then :fixnum | |||
when :integer, :float then :integer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indent when as deep as case.
And, please, apply the patch to the minor versions of the gem, at least to v2.8.0 since shoulda still requires it. |
It seems the tests failed due to the configuration not the code. If I am wrong, what happened? |
Hey @dima4p. Thank you for your PR! I just changed it so that it's now based off of the |
@dima4p No need to create a new PR. Pull down the latest changes for |
…fail Allow failure of Rails 5.0 builds during v4.0 development
ce6dbad
to
c288843
Compare
Thanks for this PR! We've merged this in 03a1d21. |
No description provided.