Permalink
Browse files

Add test for disk_usage; resolves #159. (#252)

- Update DOWNLOAD_PATH variable
- Update rubocop config
- Add test fixture directory for DOWNLOAD_PATH
  • Loading branch information...
ruebot authored and ianmilligan1 committed Jan 24, 2019
1 parent b31d036 commit e2ba4a1f9b4cf25b8c9eaba5771c7bcd38dc5031
@@ -52,6 +52,7 @@ Metrics/LineLength:
- app/jobs/textfilter_job.rb
- app/jobs/wasapi_seed_job.rb
- app/mailers/user_mailer.rb
- test/helpers/collections_helper_test.rb
- test/controllers/dashboards_controller_test.rb
- test/controllers/pages_controller_test.rb
- test/helpers/auth_helper.rb
No changes.
@@ -4,50 +4,50 @@

class CollectionsHelperTest < ActionView::TestCase
def setup
ENV['DOWNLOAD_PATH'] = '/tmp'
ENV['DOWNLOAD_PATH'] = 'test/fixtures/files'
@collections_one = collections(:one)
@collections_two = collections(:two)
end

test 'gexf path helper' do
assert_equal '/tmp/401/1234/1/derivatives/gephi/1234-gephi.gexf',
assert_equal 'test/fixtures/files/401/1234/1/derivatives/gephi/1234-gephi.gexf',
gexf_path(@collections_one.user_id,
@collections_one.collection_id,
@collections_one.account)
assert_equal '/tmp/401/3490/2/derivatives/gephi/3490-gephi.gexf',
assert_equal 'test/fixtures/files/401/3490/2/derivatives/gephi/3490-gephi.gexf',
gexf_path(@collections_two.user_id,
@collections_two.collection_id,
@collections_two.account)
end

test 'graphml path helper' do
assert_equal '/tmp/401/1234/1/derivatives/gephi/1234-gephi.graphml',
assert_equal 'test/fixtures/files/401/1234/1/derivatives/gephi/1234-gephi.graphml',
graphml_path(@collections_one.user_id,
@collections_one.collection_id,
@collections_one.account)
assert_equal '/tmp/401/3490/2/derivatives/gephi/3490-gephi.graphml',
assert_equal 'test/fixtures/files/401/3490/2/derivatives/gephi/3490-gephi.graphml',
graphml_path(@collections_two.user_id,
@collections_two.collection_id,
@collections_two.account)
end

test 'fulltext path helper' do
assert_equal '/tmp/401/1234/1/derivatives/all-text/1234-fulltext.txt',
assert_equal 'test/fixtures/files/401/1234/1/derivatives/all-text/1234-fulltext.txt',
fulltext_path(@collections_one.user_id,
@collections_one.collection_id,
@collections_one.account)
assert_equal '/tmp/401/3490/2/derivatives/all-text/3490-fulltext.txt',
assert_equal 'test/fixtures/files/401/3490/2/derivatives/all-text/3490-fulltext.txt',
fulltext_path(@collections_two.user_id,
@collections_two.collection_id,
@collections_two.account)
end

test 'domains path helper' do
assert_equal '/tmp/401/1234/1/derivatives/all-domains/1234-fullurls.txt',
assert_equal 'test/fixtures/files/401/1234/1/derivatives/all-domains/1234-fullurls.txt',
domains_path(@collections_one.user_id,
@collections_one.collection_id,
@collections_one.account)
assert_equal '/tmp/401/3490/2/derivatives/all-domains/3490-fullurls.txt',
assert_equal 'test/fixtures/files/401/3490/2/derivatives/all-domains/3490-fullurls.txt',
domains_path(@collections_two.user_id,
@collections_two.collection_id,
@collections_two.account)
@@ -4,7 +4,7 @@

class DashboardsHelperTest < ActionView::TestCase
def setup
ENV['DOWNLOAD_PATH'] = '/tmp'
ENV['DOWNLOAD_PATH'] = 'test/fixtures/files'
@dashboards_one = dashboards(:one)
@dashboards_two = dashboards(:two)
end
@@ -30,4 +30,9 @@ def setup
assert_equal 666_068, collection_size(@wasapi_files_two.collection_id,
@wasapi_files_two.user_id)
end

test 'disk usage helper' do
assert_equal '4 KB', disk_usage(@wasapi_files_one.user_id)
assert_equal '4 KB', disk_usage(@wasapi_files_two.user_id)
end
end

0 comments on commit e2ba4a1

Please sign in to comment.