spec/options_spec.rb in asciidoctor-bibliography-0.7.0 vs spec/options_spec.rb in asciidoctor-bibliography-0.7.2

- old
+ new

@@ -158,13 +158,20 @@ expect { described_class.new.merge("bibliography-sort" => "foo: bar:").sort }. to raise_exception AsciidoctorBibliography::Errors::Options::Invalid end end - describe ".new_from_reader" do + describe ".build" do + let(:document) do + ::Asciidoctor::Document.new.tap do |doc| + # NOTE: these attributes would come from CLI + doc.attributes.merge! "bibliography-database" => "high_priority" + end + end + let(:reader) do - ::Asciidoctor::PreprocessorReader.new(::Asciidoctor::Document.new, <<~SOURCE.lines) + ::Asciidoctor::PreprocessorReader.new(document, <<~SOURCE.lines) = This is the document title :bibliography-database: foo :bibliography-locale: bar :bibliography-style: baz :bibliography-hyperlinks: quz @@ -173,13 +180,13 @@ :bibliography-sort: kan :bibliography-bogus: pow SOURCE end - subject { described_class.new_from_reader reader } + subject { described_class.build document, reader } - it "extracts all bibliography options ignoring others" do - expect(subject).to eq("bibliography-database" => "foo", + it "extracts all bibliography options ignoring others and includes CLI attributes" do + expect(subject).to eq("bibliography-database" => "high_priority", "bibliography-locale" => "bar", "bibliography-style" => "baz", "bibliography-hyperlinks" => "quz", "bibliography-order" => "zod", "bibliography-tex-style" => "lep",