2015-04-09 03:48:01 -04:00
|
|
|
require 'abstract_unit'
|
|
|
|
require 'rails/code_statistics'
|
|
|
|
|
|
|
|
class CodeStatisticsTest < ActiveSupport::TestCase
|
|
|
|
def setup
|
|
|
|
@tmp_path = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', 'tmp'))
|
2016-01-11 02:42:23 -05:00
|
|
|
@dir_js = File.join(@tmp_path, 'lib.js')
|
2015-04-09 03:48:01 -04:00
|
|
|
FileUtils.mkdir_p(@dir_js)
|
|
|
|
end
|
|
|
|
|
|
|
|
def teardown
|
|
|
|
FileUtils.rm_rf(@tmp_path)
|
|
|
|
end
|
|
|
|
|
|
|
|
test 'ignores directories that happen to have source files extensions' do
|
|
|
|
assert_nothing_raised do
|
|
|
|
@code_statistics = CodeStatistics.new(['tmp dir', @tmp_path])
|
|
|
|
end
|
|
|
|
end
|
2016-01-11 02:42:23 -05:00
|
|
|
|
|
|
|
test 'ignores hidden files' do
|
|
|
|
File.write File.join(@tmp_path, '.example.rb'), <<-CODE
|
|
|
|
def foo
|
|
|
|
puts 'foo'
|
|
|
|
end
|
|
|
|
CODE
|
|
|
|
|
|
|
|
assert_nothing_raised do
|
|
|
|
CodeStatistics.new(['hidden file', @tmp_path])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-04-09 03:48:01 -04:00
|
|
|
end
|