From add97c666103092e430385abb8e7cd75e071f7ba Mon Sep 17 00:00:00 2001 From: halogenandtoast Date: Sat, 1 Feb 2014 10:58:01 -0500 Subject: [PATCH] Cleanup ConversionTable spec --- spec/conversion_table_spec.rb | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/spec/conversion_table_spec.rb b/spec/conversion_table_spec.rb index 98ed71c..75ad0c2 100644 --- a/spec/conversion_table_spec.rb +++ b/spec/conversion_table_spec.rb @@ -2,27 +2,17 @@ module Alchemist describe ConversionTable do - after(:each) do - load_file default_file - end - - it "should use the new file" do - load_file good_file - expect(conversion_table[:volume]).to eq({ litre: 1.0, swallow: 0.006, pint: 0.5506105 }) - end - it "should use the defaults when it fails to load" do - load_file bad_file - expect(5280.feet).to eq(1.mile.to.feet) + it "loads a properly formed file" do + conversion_table = ConversionTable.new + expect(conversion_table.load_all(good_file)).not_to be_nil end - def conversion_table - Alchemist.library.conversion_table + it "fails to load a improperly formed file" do + conversion_table = ConversionTable.new + expect(conversion_table.load_all(bad_file)).to be_nil end - def load_file file - Alchemist.library.load_conversion_table file - end def good_file File.join(File.dirname(__FILE__), "fixtures", "good_test.yml") @@ -31,9 +21,5 @@ def good_file def bad_file File.join(File.dirname(__FILE__), "fixtures", "bad_test.yml") end - - def default_file - Configuration::DEFAULT_UNITS_FILE - end end end