finish Book rspecs
This commit is contained in:
parent
8b0b639434
commit
febf4a9f6d
@ -1,5 +1,19 @@
|
|||||||
module Gnucash
|
module Gnucash
|
||||||
describe Book do
|
describe Book do
|
||||||
|
context "with errors" do
|
||||||
|
it "raises an error for unexpected XML" do
|
||||||
|
gr = "gr"
|
||||||
|
Zlib::GzipReader.should_receive(:open).and_return(gr)
|
||||||
|
gr.should_receive(:read).and_return(nil)
|
||||||
|
ng = "ng"
|
||||||
|
Nokogiri.should_receive(:XML).and_return(ng)
|
||||||
|
ng.should_receive(:xpath).with('/gnc-v2/gnc:book').and_return([])
|
||||||
|
|
||||||
|
expect { Gnucash::Book.new('file name') }.to raise_error "Error: Expected to find one gnc:book entry"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "without errors" do
|
||||||
before(:all) do
|
before(:all) do
|
||||||
# just open the test file once
|
# just open the test file once
|
||||||
@subject = Gnucash.open("spec/books/sample.gnucash")
|
@subject = Gnucash.open("spec/books/sample.gnucash")
|
||||||
@ -22,3 +36,4 @@ module Gnucash
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user