diff --git a/Gemfile b/Gemfile index dc53331..ac34f35 100644 --- a/Gemfile +++ b/Gemfile @@ -19,6 +19,7 @@ group :development, :test do gem 'semantic-ui-sass' gem 'foundation-rails', '~> 5.4' gem "select2-rails" + gem 'puma' #gem 'carrierwave' #gem 'fog-aws' gem 'uuidtools' diff --git a/app/models/dunlop/target_file_model.rb b/app/models/dunlop/target_file_model.rb index 8861d7b..2b023d5 100644 --- a/app/models/dunlop/target_file_model.rb +++ b/app/models/dunlop/target_file_model.rb @@ -66,10 +66,16 @@ module Dunlop::TargetFileModel gzip_file? ? result + ".gz" : result end - # TODO: consider builder.file_name if builder option is used by default. - # This will synchronize file names between regular controller downloads and - # target file creation. + # Target file basename used on creation to deliver the desired file_name. + # On actul persisted records this method cannot be used for naming. Then + # @record.original_file&.original_filename or @record.original_file_file_name + # should be used def target_basename + @target_basename ||= generate_file_name + end + + # This method should contain the dynamically generated filename, could include precise timestamp, that differs per inquiry. Should be cached on instance creation + def generate_file_name "#{self.class.name.demodulize.underscore}-#{date_number}.csv" end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 63dda7e..d1df211 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -37,7 +37,7 @@ ActiveRecord::Migration.maintain_test_schema! Capybara.javascript_driver = :poltergeist Capybara::Screenshot.webkit_options = { width: 1024, height: 768 } -Capybara.save_and_open_page_path = Rails.root.join('tmp/screenshots') +#Capybara.save_and_open_page_path = Rails.root.join('tmp/screenshots') RSpec::Support::ObjectFormatter.default_instance.max_formatted_output_length = 10_000 # do not trash string like: expected: "abc .... def"