0

フォーマッタ フック内から letDefinitions にアクセスする必要がある rspec 用のカスタム フォーマッタを作成しようとしています。

与えられた:

describe "Example" do
  let(:something) { "foo" }

  context "something to test" do
    # .....   
  end

end

私のフォーマッタでは:

class MyFormatter
  RSpec::Core::Formatters.register self, :example_started

  def example_started(notification)
    @output << "Output of #{value_of_let(:something,notification)}"
  end

  private
  def value_of_let(what, notification)
    ### is there a way to find :something / 'foo' in notification?
  end
end
4

1 に答える 1