1

次のようなオプションPandoc.convertで呼び出されることを確認したい:to: :docx

options = {to: :docx}
PandocRuby.convert("some string", options)

仕様には次の期待があります。

expect(PandocRuby).to receive(:convert).with(hash_including(to: :docx))

仕様は次のように失敗します。

 Failure/Error: expect(PandocRuby).to receive(:convert).with(hash_including(to: :docx))

   (PandocRuby (class)).convert(hash_including(:to=>:docx))
       expected: 1 time with arguments: (hash_including(:to=>:docx))
       received: 0 times

しかし、デバッグ時optionsは次のようになります。

[2] pry(#<ReportDocumentsController>)> options
=> {
    :to => :docx,
    :reference_docx => "/Users/josh/Documents/Work/Access4All/Projects/a4aa2/src/public/uploads/report_template/reference_docx/1/reference.docx"
}

間違った RSpec マッチャ (または正しいものを間違った方法で) を使用していると思いますが、動作させることができません。

4

1 に答える 1