-
-
Notifications
You must be signed in to change notification settings - Fork 638
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
Bumps rspec to 3.0.0 (release) and fixes deprecation warnings #4
Conversation
Thanks @andypike, I'm setting up Appraisal so I can properly test CanCanCan vs multiple versions of Rails, I'll do something similar using this for RSpec as well. Thanks for your help! |
@@ -7,12 +7,12 @@ | |||
|
|||
it "is able to :read anything" do | |||
@ability.can :read, :all | |||
expect(@ability.can?(:read, String)).to be_true | |||
expect(@ability.can?(:read, 123)).to be_true | |||
expect(@ability.can?(:read, String)).to be(true) |
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.
You could use be_truthy/be_falsey
instead.
rspec/rspec-expectations#283
What do you think?
As soon as RSpec 3.0 has been released http://rubygems.org/gems/rspec |
Rspec 3.0 released |
@@ -17,7 +17,7 @@ Gem::Specification.new do |s| | |||
s.files = Dir["{lib,spec}/**/*", "[A-Z]*", "init.rb"] - ["Gemfile.lock"] | |||
s.require_path = "lib" | |||
|
|||
s.add_development_dependency 'rspec', '~> 2.14' | |||
s.add_development_dependency 'rspec', '~> 3.0.0.beta2' |
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.
You also could update to '~> 3.0.0'
👍 |
I'll update the PR and will push up for you shortly 😄 |
Actually, looking at master some of these changes have already made it in. Not sure if this PR is of much value. Should we close this? |
Nope. Most important changes doesn't exists in master: |
OK 😄 I've merged upstream master and bumped rspec to the 3.0.0 release. All specs pass and no deprecation warnings. I've kept the Hope this is ok with everyone ✨ ❤️ |
@andypike Thanks! 🔆 |
Thanks so much for this! I haven't had a chance to look this over, but will it support |
Any word on this? Anything I can do to help? |
I haven't had a chance to look at the |
Sorry, I've been in the middle of a move to a new country and have been super busy. I should have time to take a look at this tomorrow, I know its needed by many. |
Ok, I had to do a bit of tweaking to get backwards compatibility so i've merged this into #85... just waiting on Travis, but all looks good locally with both RSpec 2 and RSpec 3, so I'll merge this and release |
I'm getting:
when using rspec 2.99.0 and cancancan 1.8.3. It works fine with cancan 1.8.2 when running a test like:
|
Perhaps we need to add: alias failure_message_for_should failure_message
alias failure_message_for_should_not failure_message_when_negated as was done in #10 |
Bah, I tried with RSpec 2.14 and 3.0, here must be something in their 2.99 'deprecation' release... Lemme have a quick look, and i'll pull |
@jcoyne Do you mind testing against: I've changed the way we detect the custom matcher error method, it works locally for me for RSpec 2.14, 2.99, and 3, but I'd like a second opinion. |
@bryanrite I tested that branch. It works great. 👏 |
@jcoyne Thanks! Pushed 1.8.4 |
author Remo Fritzsche <remo.fritzsche@sitrox.com> 1612868567 +0100 committer Alessandro Rodi <coorasse@gmail.com> 1657114188 +0200 # This is a combination of 4 commits. # This is the 1st commit message: Preserve nil values as extra arguments # This is the commit message #2: Fix link (#744) # This is the commit message #3: Documentation fixes and improvements - fix typo, punctuations, and grammar - fix broken and misformatted links - fix code sample # This is the commit message #4: Format documentation/guides and fix linting issues The motivation of the changes is to make these documents neater when reading offline using a text or code editor. Reading the documentation offline is faster, and the source code is readily available for further learning. The changes do not affect the meaning of each documentation or instruction. The following changes were made: - remove extra and trailing spaces - add new lines to separate the title, explanation, code samples, etc - fix headings, links - specify code block language (bash, ruby) Updated Devise.md as exception is changed CanCan::Unathorized exception not exists anymore, CanCan::AccessDenied is used. Also added responses for different content types as a recommendation. Add support for non-hash conditions Co-authored-by: Juleffel <juleffel@protonmail.com> Improve ability checks with Hashes Add Ruby 3.0 and Ruby 3.1 to CI Drop ActiveRecord4 from CI (#778)
author Remo Fritzsche <remo.fritzsche@sitrox.com> 1612868567 +0100 committer Alessandro Rodi <coorasse@gmail.com> 1657114188 +0200 # This is a combination of 4 commits. # This is the 1st commit message: Preserve nil values as extra arguments # This is the commit message #2: Fix link (#744) # This is the commit message #3: Documentation fixes and improvements - fix typo, punctuations, and grammar - fix broken and misformatted links - fix code sample # This is the commit message #4: Format documentation/guides and fix linting issues The motivation of the changes is to make these documents neater when reading offline using a text or code editor. Reading the documentation offline is faster, and the source code is readily available for further learning. The changes do not affect the meaning of each documentation or instruction. The following changes were made: - remove extra and trailing spaces - add new lines to separate the title, explanation, code samples, etc - fix headings, links - specify code block language (bash, ruby) Updated Devise.md as exception is changed CanCan::Unathorized exception not exists anymore, CanCan::AccessDenied is used. Also added responses for different content types as a recommendation. Add support for non-hash conditions Co-authored-by: Juleffel <juleffel@protonmail.com> Improve ability checks with Hashes Add Ruby 3.0 and Ruby 3.1 to CI Drop ActiveRecord4 from CI (#778)
author Remo Fritzsche <remo.fritzsche@sitrox.com> 1612868567 +0100 committer Alessandro Rodi <coorasse@gmail.com> 1657114188 +0200 # This is a combination of 4 commits. # This is the 1st commit message: Preserve nil values as extra arguments # This is the commit message #2: Fix link (#744) # This is the commit message #3: Documentation fixes and improvements - fix typo, punctuations, and grammar - fix broken and misformatted links - fix code sample # This is the commit message #4: Format documentation/guides and fix linting issues The motivation of the changes is to make these documents neater when reading offline using a text or code editor. Reading the documentation offline is faster, and the source code is readily available for further learning. The changes do not affect the meaning of each documentation or instruction. The following changes were made: - remove extra and trailing spaces - add new lines to separate the title, explanation, code samples, etc - fix headings, links - specify code block language (bash, ruby) Updated Devise.md as exception is changed CanCan::Unathorized exception not exists anymore, CanCan::AccessDenied is used. Also added responses for different content types as a recommendation. Add support for non-hash conditions Co-authored-by: Juleffel <juleffel@protonmail.com> Improve ability checks with Hashes Add Ruby 3.0 and Ruby 3.1 to CI Drop ActiveRecord4 from CI (#778)
author Remo Fritzsche <remo.fritzsche@sitrox.com> 1612868567 +0100 committer Alessandro Rodi <coorasse@gmail.com> 1657114188 +0200 # This is a combination of 4 commits. # This is the 1st commit message: Preserve nil values as extra arguments # This is the commit message #2: Fix link (#744) # This is the commit message #3: Documentation fixes and improvements - fix typo, punctuations, and grammar - fix broken and misformatted links - fix code sample # This is the commit message #4: Format documentation/guides and fix linting issues The motivation of the changes is to make these documents neater when reading offline using a text or code editor. Reading the documentation offline is faster, and the source code is readily available for further learning. The changes do not affect the meaning of each documentation or instruction. The following changes were made: - remove extra and trailing spaces - add new lines to separate the title, explanation, code samples, etc - fix headings, links - specify code block language (bash, ruby) Updated Devise.md as exception is changed CanCan::Unathorized exception not exists anymore, CanCan::AccessDenied is used. Also added responses for different content types as a recommendation. Add support for non-hash conditions Co-authored-by: Juleffel <juleffel@protonmail.com> Improve ability checks with Hashes Add Ruby 3.0 and Ruby 3.1 to CI Drop ActiveRecord4 from CI (#778)
author Remo Fritzsche <remo.fritzsche@sitrox.com> 1612868567 +0100 committer Alessandro Rodi <coorasse@gmail.com> 1657114188 +0200 # This is a combination of 4 commits. # This is the 1st commit message: Preserve nil values as extra arguments # This is the commit message #2: Fix link (#744) # This is the commit message #3: Documentation fixes and improvements - fix typo, punctuations, and grammar - fix broken and misformatted links - fix code sample # This is the commit message #4: Format documentation/guides and fix linting issues The motivation of the changes is to make these documents neater when reading offline using a text or code editor. Reading the documentation offline is faster, and the source code is readily available for further learning. The changes do not affect the meaning of each documentation or instruction. The following changes were made: - remove extra and trailing spaces - add new lines to separate the title, explanation, code samples, etc - fix headings, links - specify code block language (bash, ruby) Updated Devise.md as exception is changed CanCan::Unathorized exception not exists anymore, CanCan::AccessDenied is used. Also added responses for different content types as a recommendation. Add support for non-hash conditions Co-authored-by: Juleffel <juleffel@protonmail.com> Improve ability checks with Hashes Add Ruby 3.0 and Ruby 3.1 to CI Drop ActiveRecord4 from CI (#778)
We are using cancan in a rails 4 project. When we upgraded to rspec 3.0.0.beta2 we got a few deprecation warnings from cancan. Upon investigation, cancan seems to be dead but we found that cancancan seemed to be the successor.
To fix the deprecation we bumped rspec to 3.0.0.beta2 and fixed all the deprecation warnings. All the specs pass and I'm currently using this branch in our rails 4 project (everything still green).
I'm not sure what the plan is for cancancan and rspec compatibility, but if you want to move to rspec 3, this is a good starting point for you.
Enjoy.