Commit a58990f
Changed files (3)
app
models
spec
models
app/models/backup_file.rb
@@ -17,7 +17,9 @@ class BackupFile
end
def valid?
- File.extname(backup_file.path).start_with?(".stronglifts")
+ extension = File.extname(backup_file.path)
+ extension.start_with?(".stronglifts") ||
+ extension.start_with?(".csv")
end
private
spec/models/backup_file_spec.rb
@@ -13,6 +13,12 @@ describe BackupFile do
expect(subject).to be_valid
end
+ it 'returns true for csv exports' do
+ csv_export = fixture_file("spreadsheet-stronglifts.csv")
+ subject = BackupFile.new(user, csv_export)
+ expect(subject).to be_valid
+ end
+
it "returns false" do
subject = BackupFile.new(user, fixture_file("unknown.file"))
expect(subject).to_not be_valid
spec/factories.rb
@@ -47,7 +47,6 @@ FactoryGirl.define do
filename: 'spreadsheet-stronglifts.csv',
type: 'text/plain',
tempfile: File.new("#{File.expand_path(File.dirname(__FILE__))}/fixtures/spreadsheet-stronglifts.csv")
- #tempfile: fixture_file_upload("spreadsheet-stronglifts.csv")
})
]}
end