Sha256: 1d62ca1c19d4b45b0bd8f4b0793ee51b99dcb1c38b7c850dfe8254f4751f6e70
Contents?: true
Size: 940 Bytes
Versions: 1
Compression:
Stored size: 940 Bytes
Contents
require 'test_helper' class FileStringTest < ActiveSupport::TestCase setup :create_file test "methods should work properly" do # Basic tests assert @file.exists? assert_equal 11, @file.size assert_equal '.txt', @file.extname assert_equal ::File.join('', 'uploads', 'files', @file.filename), @file.path assert_equal Rails.root.join('tmp', 'uploads', 'files', @file.filename).to_s, @file.realpath # Delete tests uploads_path = Rails.root.join('tmp', 'uploads', 'files', @file.filename).to_s @file.delete assert !::File.exists?(uploads_path) assert !@file.exists? end protected def create_file FileUtils.mkdir_p Rails.root.join('tmp', 'uploads', 'files') filename = 'file.txt' FileUtils.cp ::File.join(ActiveSupport::TestCase.fixture_path, filename), Rails.root.join('tmp', 'uploads', 'files', filename) @file = RailsUploads::Types::File.new(filename) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rails_uploads-0.1.5 | test/file_string_test.rb |