thoughtbot/shoulda-matchers · error · NotImplementedError

with_options is not a valid qualifier for the define_enum_fo

Error message

with_options is not a valid qualifier for the define_enum_for matcher. Did you mean to use with_values instead?

What it means

Error "with_options is not a valid qualifier for the define_enum_for matcher. Did you mean to use with_values instead?" thrown in thoughtbot/shoulda-matchers.

Source

Thrown at lib/shoulda/matchers/active_record/define_enum_for_matcher.rb:324

            description << ", suffix: #{options[:suffix].inspect}"
          end

          description
        end

        def validating(value = true, allowing_nil: false)
          options[:validating] = value
          options[:allowing_nil] = allowing_nil
          self
        end

        def with_values(expected_enum_values)
          options[:expected_enum_values] = expected_enum_values
          self
        end

        def with_options(**)
          raise NotImplementedError,
            'with_options is not a valid qualifier for the define_enum_for matcher. '\
            'Did you mean to use with_values instead?'
        end

        def with_prefix(expected_prefix = true)
          options[:prefix] = expected_prefix
          self
        end

        def with_suffix(expected_suffix = true)
          options[:suffix] = expected_suffix
          self
        end

        def backed_by_column_of_type(expected_column_type)
          options[:expected_column_type] = expected_column_type
          self
        end

View on GitHub (pinned to 79cdfbc326)

When it happens

Trigger: Thrown at lib/shoulda/matchers/active_record/define_enum_for_matcher.rb:324 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of thoughtbot/shoulda-matchers@79cdfbc326 (2026-08-23). Data as JSON: /api/errors/52b623349b7d72a7. Report an issue: GitHub.