shoulda-matchers: NoMethodError: undefined method `optional'

minitest (5.10.3, 5.10.1)
shoulda-matchers (3.1.2)
require "test_helper"

describe Event do
  subject { Event.new }
  it { must belong_to(:visit).optional }
end

=>

NoMethodError: undefined method `optional' for #<Shoulda::Matchers::ActiveRecord::AssociationMatcher:0x00007f96daad39f0>
Did you mean?  options

How to use optional matcher in my case?

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 2
  • Comments: 15

Most upvoted comments

@dgorodnichy @Maychell Oh, derp – this is only available on the master branch, this isn’t in a release just yet.

When do you expect to release a stable version with the optional method? πŸ™

Upvote, waiting for the stable release πŸ˜ƒ πŸ‘

@mkalygin @jasonperrone Yes, I’d advise using the master branch if you really need this.

Hi @kleinjm

We still have some open issues for 4.0.0.

You can follow the progress and find issues to contribute for the next verion at: https://github.com/thoughtbot/shoulda-matchers/milestone/13

Upvote!