method

convert_constraint

rspec latest stable - Class: Spec::Mocks::ArgumentExpectation

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (1.1.4) is shown here.

convert_constraint(constraint)
public

No documentation available.

# File lib/spec/mocks/argument_expectation.rb, line 170
      def convert_constraint(constraint)
        if [:anything, :numeric, :boolean, :string].include?(constraint)
          case constraint
          when :anything
            instead = "anything()"
          when :boolean
            instead = "boolean()"
          when :numeric
            instead = "an_instance_of(Numeric)"
          when :string
            instead = "an_instance_of(String)"
          end
          warn_deprecated(constraint.inspect, instead)
          return @@constraint_classes[constraint].new(constraint)
        end
        return MatcherConstraint.new(constraint) if is_matcher?(constraint)
        return RegexpArgConstraint.new(constraint) if constraint.is_a?(Regexp)
        return LiteralArgConstraint.new(constraint)
      end