diff --git a/.dockerignore b/.dockerignore index 4a0352b..6fe2891 100644 --- a/.dockerignore +++ b/.dockerignore @@ -6,7 +6,6 @@ !vendor/ #keep these directories but nothing in them -lib/* log/* tmp/* vendor/* diff --git a/test/fixtures/cost_centre_fixture.csv b/config/cost_centre_fixture.csv similarity index 100% rename from test/fixtures/cost_centre_fixture.csv rename to config/cost_centre_fixture.csv diff --git a/config/initializers/cost_centers.rb b/config/initializers/cost_centers.rb index db99e2d..6468a84 100644 --- a/config/initializers/cost_centers.rb +++ b/config/initializers/cost_centers.rb @@ -16,7 +16,7 @@ def load_from_s3(bucket, key) data = if ENV.has_key?('COST_CENTRE_S3_BUCKET_NAME') load_from_s3(ENV['COST_CENTRE_S3_BUCKET_NAME'], 'cost_centres.csv') else - File.read(File.join(Rails.root, 'test', 'fixtures', 'cost_centre_fixture.csv')) + File.read(File.join(Rails.root, 'config', 'cost_centre_fixture.csv')) end COST_CENTRES = CostCentreReader.new(data) diff --git a/app/lib/cost_centre_reader.rb b/lib/cost_centre_reader.rb similarity index 100% rename from app/lib/cost_centre_reader.rb rename to lib/cost_centre_reader.rb diff --git a/test/lib/cost_centre_reader_test.rb b/test/lib/cost_centre_reader_test.rb index 97f36f5..6f4165a 100644 --- a/test/lib/cost_centre_reader_test.rb +++ b/test/lib/cost_centre_reader_test.rb @@ -1,8 +1,9 @@ require 'test_helper' +require "cost_centre_reader" class CostCentreReaderTest < ActiveSupport::TestCase test 'we can read a cost centre CSV file' do - fixture_data = File.read(File.dirname(__FILE__) + "/../fixtures/cost_centre_fixture.csv") + fixture_data = File.read(File.join(Rails.root, 'config', 'cost_centre_fixture.csv')) cost_centres = CostCentreReader.new(fixture_data) cost_centre = cost_centres.get_by_cost_centre_code("12345678") @@ -15,7 +16,7 @@ class CostCentreReaderTest < ActiveSupport::TestCase end test 'we return nil if no matching cost centre' do - fixture_data = File.read(File.dirname(__FILE__) + "/../fixtures/cost_centre_fixture.csv") + fixture_data = File.read(File.join(Rails.root, 'config', 'cost_centre_fixture.csv')) cost_centres = CostCentreReader.new(fixture_data) non_extant_code = "999999"