Git Product home page Git Product logo

Comments (9)

JustinAiken avatar JustinAiken commented on May 12, 2024 1

Also, this probably isn't needed since that PR fixes it, but for future reference, in case anybody has issues in the future and googles this:

My spec_helper started with:

require File.dirname(__FILE__) + "/../config/environment" unless defined?(Rails.root)

require 'shoulda'
require 'cancan/matchers'
require 'rspec/rails'
require 'timecop'
require 'webmock/rspec'

...and before this PR, failed unless I added require 'rspec/expectations' right before requireing cancan's matchers - with this PR my spec_helper remains as is.

from cancancan.

JustinAiken avatar JustinAiken commented on May 12, 2024

This doesn't happen with Rspec 2.13 - something changed between 2.13 and 2.14 that changed this.

If I just add require 'rspec/expectations' to the top of lib/cancan/matchers.rb, it works okay. Not sure if that would break compatibility with other versions of rspec though. Also works if I add that line to my own spec_helper before I require cancan.

from cancancan.

bryanrite avatar bryanrite commented on May 12, 2024

This is on master or 1.7.0?

from cancancan.

bryanrite avatar bryanrite commented on May 12, 2024

bah.. obviously the 1.7.0... sorry... i'll check it out.

from cancancan.

bryanrite avatar bryanrite commented on May 12, 2024

Upon some investigation:

https://github.com/rspec/rspec/commit/15ef280ac74b03f612d6038f484d80226fb38e03

Removed explicitly requiring both expectations and mocks. So it should be fixable by:

Removing

require 'rspec'

and adding

require 'rspec/core'
require 'rspec/expectations'
require 'rspec/mocks'

I'll get this in asap as a patch release.

from cancancan.

bryanrite avatar bryanrite commented on May 12, 2024

@JustinAiken I haven't actually been able to duplicate your issue, no matter where I require cancan/matches ... Could you try running against:

https://github.com/CanCanCommunity/cancancan/tree/feature/fix_rspec

And let me know if that fixes it, either that or paste a minimal spec_helper. Super appreciated!

from cancancan.

bryanrite avatar bryanrite commented on May 12, 2024

@JustinAiken ping?

from cancancan.

JustinAiken avatar JustinAiken commented on May 12, 2024

Oh, haha... I was bundleing up that ref as you pinged me :)

Yes confirmed - that fixes it :)

from cancancan.

bryanrite avatar bryanrite commented on May 12, 2024

hahaha... great thanks, I'll push a 1.7.1 release today.

from cancancan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.