Skip to content

Commit

Permalink
Added spec for generating *.dat file
Browse files Browse the repository at this point in the history
  • Loading branch information
ngiger committed Dec 11, 2013
1 parent d9f6ad7 commit 6401d53
Showing 1 changed file with 26 additions and 6 deletions.
32 changes: 26 additions & 6 deletions spec/builder_spec.rb
Expand Up @@ -59,12 +59,12 @@ def capture(stream)
article_xml.should match(/<SMNO>53662013</)
article_xml.should match(/<DSCRD>3TC Filmtabl 150 mg</)
article_xml.should match(/<COMPNO>7601001392175</)
article_xml.should match(/<BC>7680536620137</)
article_xml.should match(/<VDAT>01.10.2011</)
article_xml.should match(/<PTYP>PEXF</)
article_xml.should match(/<PRICE>164.55</)
article_xml.should match(/<PTYP>PPUB</)
article_xml.should match(/<PRICE>205.3</)
article_xml.should match(/<BC>7680536620137</)
article_xml.should match(/<VDAT>01.10.2011</)
article_xml.should match(/<PTYP>PEXF</)
article_xml.should match(/<PRICE>164.55</)
article_xml.should match(/<PTYP>PPUB</)
article_xml.should match(/<PRICE>205.3</)

article_xml.should match(/Levetiracetam DESITIN/i) #
article_xml.should match(/7680536620137/) # Pharmacode
Expand All @@ -79,5 +79,25 @@ def capture(stream)
article_xml.should match(/<COMPNO>7601001320451</)
end
end

context 'when -a nonpharma -f dat is given' do
let(:cli) do
opts = {
:nonpharma => 'true',
:format => :dat,
}
Oddb2xml::Cli.new(opts)
end
it 'should generate a valid oddb_with_migel.dat' do
res = capture(:stdout){ cli.run }
res.should match(/products/)
dat_filename = File.expand_path(File.join(File.dirname(__FILE__), '..', 'oddb_with_migel.dat'))
File.exists?(dat_filename).should be_true
oddb_dat = IO.read(dat_filename)
# $stdout.puts oddb_dat
# return
oddb_dat.should match(/1115819012LEVETIRACETAM DESITIN Filmtabl 250 mg 30 Stk 001349002780100B010710076806206900842/)
end
end
end

0 comments on commit 6401d53

Please sign in to comment.