ValidationMatcher
@private
# File lib/shoulda/matchers/active_model/validate_uniqueness_of_matcher.rb, line 198 def allow_nil @options[:allow_nil] = true self end
# File lib/shoulda/matchers/active_model/validate_uniqueness_of_matcher.rb, line 193 def case_insensitive @options[:case_insensitive] = true self end
# File lib/shoulda/matchers/active_model/validate_uniqueness_of_matcher.rb, line 203 def description result = "require " result << "case sensitive " unless @options[:case_insensitive] result << "unique value for #{@attribute}" result << " scoped to #{@options[:scopes].join(', ')}" if @options[:scopes].present? result end
# File lib/shoulda/matchers/active_model/validate_uniqueness_of_matcher.rb, line 211 def matches?(subject) @subject = subject.class.new @expected_message ||= :taken set_scoped_attributes && validate_everything_except_duplicate_nils? && validate_after_scope_change? && allows_nil? end
Generated with the Darkfish Rdoc Generator 2.