method
convert_constraint

1.1.4 -
Show latest stable
-
0 notes -
Class: Spec::Mocks::ArgumentExpectation
- 1.1.4 (0)
- 1.1.12
- 1.2.0
- 1.2.8
- 1.3.0
- 1.3.1
- What's this?
convert_constraint(constraint)
public
Hide source
# 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