0
私はthis answerを見て、私はfailure_message_when_negated
部分を理解しませんでした。RSpec Matchersで 'failure_message_when_negated'とは何を意味していますか?
RSpec::Matchers.define :have_attr_accessor do |field|
match do |object_instance|
object_instance.respond_to?(field) &&
object_instance.respond_to?("#{field}=")
end
failure_message do |object_instance|
"expected attr_accessor for #{field} on #{object_instance}"
end
failure_message_when_negated do |object_instance|
"expected attr_accessor for #{field} not to be defined on #{object_instance}"
end
description do
"assert there is an attr_accessor of the given name on the supplied object"
end
end
単純な言葉ではどういう意味ですか?私は本当に明確ではない、foo-barの説明に感謝します。