Switch branches/tags
Find file
Fetching contributors…
Cannot retrieve contributors at this time
19 lines (14 sloc) 634 Bytes
require 'language_sniffer'
require 'test/unit'
class TestSniffer < Test::Unit::TestCase
def test_sniffer
# path and content given -> does not read file
assert_equal 'Ruby', LanguageSniffer.detect('foo/bar', :content => '#!/usr/bin/env ruby')
# pure un-descriptive path -> reads file
assert_equal 'Ruby', LanguageSniffer.detect('bin/language_sniffer')
# pure descriptive path -> does not need to read file
assert_equal 'Ruby', LanguageSniffer.detect('foo/bar.rb')
# empty
assert_equal nil, LanguageSniffer.detect('test/fixtures/blank').language