0

I get an issue when launching rspec

Failure/Error:
       expect {
         post :create, params: {tag: attributes_for(:tag)}
       }.to change(Tag, :count).by(1)

     NameError:
       undefined local variable or method `matcher_name' for #<RSpec::Matchers::BuiltIn::Change:0x000000094f7348>
       Did you mean?  match_unless_raises

Edit :

it only occurs when I do

rspec

instead of

bundle exec rspec
Sergio Tulentsev
  • 226,338
  • 43
  • 373
  • 367
Xero
  • 3,951
  • 4
  • 41
  • 73

2 Answers2

1

The console error log says probably you are supplying wrong method name, That's clear. Can you try changing the name of the method or variable which you are using?

You can also refer this for getting the difference between those two commands bundle exec rspec VS rspec spec

Aashish
  • 787
  • 6
  • 16
1

Always use bundle exec with your project-related binaries. Without it, a wrong version is likely picked up. Check it.

rspec --version
bundle exec rspec --version
Sergio Tulentsev
  • 226,338
  • 43
  • 373
  • 367