Skip to content

Commit

Permalink
Test: when both regcodes.xml, regcodes.txt exist
Browse files Browse the repository at this point in the history
  • Loading branch information
mvidner committed Feb 19, 2016
1 parent 5b950b5 commit cc3f65b
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/registration_codes_loader_spec.rb
Expand Up @@ -58,6 +58,26 @@ class RegistrationCodesLoaderTest
end
end

context "when both regcodes.xml, regcodes.txt exist" do
it "delegates to reg_codes_from_xml" do
allow(subject).to receive(:get_file_from_url)
.with(scheme: "usb", host: "", urlpath: "/#{xmlname}",
localfile: tempfile,
urltok: {}, destdir: "")
.and_return(true)
allow(subject).to receive(:get_file_from_url)
.with(scheme: "usb", host: "", urlpath: "/#{txtname}",
localfile: tempfile,
urltok: {}, destdir: "")
.and_return(true)

expect(subject).to receive(:reg_codes_from_xml)
.with(tempfile)
.and_return("a" => "b")

expect(subject.reg_codes_from_usb_stick).to eq("a" => "b")
end
end

context "when neither regcodes.* exists" do
it "returns nil" do
Expand Down

0 comments on commit cc3f65b

Please sign in to comment.