class CapitalizeAttributes::Matchers::CapitalizeAttributeMatcher
Public Class Methods
new(attributes)
click to toggle source
# File lib/capitalize_attributes/matchers.rb, line 17 def initialize(attributes) @attributes = attributes @options = {} end
Public Instance Methods
description()
click to toggle source
# File lib/capitalize_attributes/matchers.rb, line 44 def description "capitalize #{@attributes.map { |el| "##{el}" }.to_sentence}" end
failure_message()
click to toggle source
# File lib/capitalize_attributes/matchers.rb, line 31 def failure_message # RSpec 3.x "Expected #{@attribute} to be capitalized, but it was not" end
Also aliased as: failure_message_for_should
failure_message_when_negated()
click to toggle source
# File lib/capitalize_attributes/matchers.rb, line 37 def failure_message_when_negated # RSpec 3.x "Expected #{@attribute} not to be capitalized, but it was" end
Also aliased as: failure_message_for_should_not, negative_failure_message
matches?(subject)
click to toggle source
# File lib/capitalize_attributes/matchers.rb, line 22 def matches?(subject) @attributes.all? do |attribute| @attribute = attribute subject.send("#{@attribute}=", "string") subject.validate subject.send(@attribute) == "String" end end