Skip to content

Commit

Permalink
Cleanup rspec
Browse files Browse the repository at this point in the history
  • Loading branch information
ngiger committed May 6, 2014
1 parent 5a28847 commit c39085f
Show file tree
Hide file tree
Showing 15 changed files with 7 additions and 14 deletions.
4 changes: 2 additions & 2 deletions spec/builder_spec.rb
Expand Up @@ -24,14 +24,14 @@ def buildr_capture(stream)
NrPharmaArticles = 4
include ServerMockHelper
before(:each) do
@saveddir = Dir.pwd
@savedDir = Dir.pwd
cleanup_directories_before_run
setup_server_mocks
setup_swiss_index_server_mock(types = ['NonPharma', 'Pharma'])
Dir.chdir Oddb2xml::WorkDir
end
after(:each) do
Dir.chdir @saveddir
Dir.chdir @savedDir if @savedDir and File.directory?(@savedDir)
end

context 'should handle BAG-articles with and without pharmacode' do
Expand Down
5 changes: 1 addition & 4 deletions spec/cli_spec.rb
Expand Up @@ -2,8 +2,6 @@

require 'spec_helper'

# for stdout/stderr on ruby 1.8.7
# $stdout.should_receive(:puts).with() does not work
module Kernel
def cli_capture(stream)
begin
Expand Down Expand Up @@ -55,7 +53,7 @@ def cli_capture(stream)
Dir.chdir(Oddb2xml::WorkDir)
end
after(:each) do
Dir.chdir(@savedDir)
Dir.chdir(@savedDir) if @savedDir and File.directory?(@savedDir)
cleanup_compressor
end
context 'when -c tar.gz option is given' do
Expand Down Expand Up @@ -108,7 +106,6 @@ def cli_capture(stream)
it 'should not create any xml file' do
Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_*.xml')).each do |file| FileUtil.rm_f(file) end
cli_capture(:stdout) { cli.run }.should match(/Pharma/)
$stderr.puts Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_*.xml'))
Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_*.xml')).each do |file|
File.exists?(file).should be_false
end
Expand Down
4 changes: 2 additions & 2 deletions spec/compressor_spec.rb
Expand Up @@ -85,7 +85,7 @@
@compressor = Oddb2xml::Compressor.new
end
after(:each) do
Dir.chdir @savedDir
Dir.chdir @savedDir if @savedDir and File.directory?(@savedDir)
end
it 'should fail with no contents' do
@compressor.finalize!.should == false
Expand All @@ -111,7 +111,7 @@
@compressor = Oddb2xml::Compressor.new('oddb', {:compress_ext => 'zip'})
end
after(:each) do
Dir.chdir @savedDir
Dir.chdir @savedDir if @savedDir and File.directory?(@savedDir)
end
it_behaves_like 'any compressor' if true
end
Expand Down
1 change: 0 additions & 1 deletion spec/data/Gestrichene_Packungen_Emballages_radies.xls

This file was deleted.

1 change: 0 additions & 1 deletion spec/data/Publications.xls

This file was deleted.

Empty file removed spec/data/oddb_article.xml
Empty file.
Empty file removed spec/data/oddb_fi.xml
Empty file.
Empty file removed spec/data/oddb_fi_product.xml
Empty file.
Empty file removed spec/data/oddb_limitation.xml
Empty file.
Empty file removed spec/data/oddb_product.xml
Empty file.
Empty file removed spec/data/oddb_substance.xml
Empty file.
Binary file removed spec/data/swissmedic_packages.xls
Binary file not shown.
2 changes: 1 addition & 1 deletion spec/downloader_spec.rb
Expand Up @@ -24,7 +24,7 @@ def common_before
end

def common_after
Dir.chdir(@savedDir)
Dir.chdir(@savedDir) if @savedDir and File.directory?(@savedDir)
end

describe Oddb2xml::BagXmlDownloader do
Expand Down
2 changes: 0 additions & 2 deletions spec/extractor_spec.rb
Expand Up @@ -142,7 +142,6 @@
end
it { expect(subject.to_hash.keys.length).to eq(1) }
it { expect(subject.to_hash.keys.first).to eq("7680316440115") }
# it { expect(subject.to_hash.values.first[:vat]).to eq("2") }
it { expect(subject.to_hash.values.first[:price]).to eq("8.95") }
end
context 'when Estradiol Creme is given' do
Expand All @@ -155,7 +154,6 @@
#it { expect(pp subject.to_hash) }
it { expect(subject.to_hash.keys.length).to eq(1) }
it { expect(subject.to_hash.keys.first).to eq("7680284070840") }
# it { $stderr.puts "xxx #{subject.to_hash.values.first.inspect}" }
it { expect(subject.to_hash.values.first[:vat]).to eq("2") }
it { expect(subject.to_hash.values.first[:price]).to eq("9.40") }
it { expect(subject.to_hash.values.first[:pub_price]).to eq("16.30") }
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Expand Up @@ -39,7 +39,7 @@ def cleanup_compressor
end
def cleanup_directories_before_run
dirs = [ Oddb2xml::Downloads, Oddb2xml::WorkDir]
dirs.each{ |dir| FileUtils.rm_rf(dir, :verbose => false) }
dirs.each{ |dir| FileUtils.rm_rf(Dir.glob(File.join(dir, '*')), :verbose => false) }
dirs.each{ |dir| FileUtils.makedirs(dir, :verbose => false) }
cleanup_compressor
end
Expand Down

0 comments on commit c39085f

Please sign in to comment.