thoughtbot/shoulda-matchers · error · ArgumentError

need at least one argument

Error message

need at least one argument

What it means

Error "need at least one argument" thrown in thoughtbot/shoulda-matchers.

Source

Thrown at lib/shoulda/matchers/active_model/allow_value_matcher.rb:328

      #       it do
      #         should_not allow_value([]).
      #           for(:zip_code).
      #           ignoring_interference_by_writer
      #       end
      #     end
      #
      #     # Minitest (Shoulda)
      #     class AddressTest < ActiveSupport::TestCase
      #       should_not allow_value([]).
      #         for(:zip_code).
      #         ignoring_interference_by_writer
      #     end
      #
      # @return [AllowValueMatcher]
      #
      def allow_value(*values)
        if values.empty?
          raise ArgumentError, 'need at least one argument'
        else
          AllowValueMatcher.new(*values)
        end
      end
      # @private
      alias_method :allow_values, :allow_value

      # @private
      class AllowValueMatcher
        include Helpers
        include Qualifiers::IgnoringInterferenceByWriter

        attr_reader(
          :after_setting_value_callback,
          :attribute_to_check_message_against,
          :attribute_to_set,
          :context,
          :instance,

View on GitHub (pinned to 79cdfbc326)

When it happens

Trigger: Thrown at lib/shoulda/matchers/active_model/allow_value_matcher.rb:328 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/4c40928176609fed. Report an issue: GitHub.