我正在生成一些自动规格,我想有一个自定义的成功消息,与时代的期望是成功。
例如,我希望报告如下:

Opportunity
  .rating_info
    where the real estate kind is Monoambiente
      and there aren't assigned values
        is 0
      when there are multiple combinations
        is has the expected value(run 45 different combinations)

最佳答案

似乎it's possible through use of a custom formatter

class PedrazaFormatter < BaseTextFormatter
        Formatters.register self, :example_passed

        def init(times = 0)
          self.times = times
        end

        def example_passed(_notification)
          output.print "Test was successful #{self.times} times"
        end
end

我希望这能有帮助如果你还有其他问题,请告诉我。

关于ruby-on-rails - 如何将自定义文本添加到成功rspec消息,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/30137579/

10-15 01:57