Class: PathnameTest
- Inherits:
-
Test::Unit::TestCase
- Object
- Test::Unit::TestCase
- PathnameTest
- Defined in:
- lib/sprockets/test/test_pathname.rb
Instance Method Summary collapse
- #setup ⇒ Object
- #test_absolute_location_is_automatically_expanded ⇒ Object
- #test_equality_of_pathnames ⇒ Object
- #test_find_should_return_a_pathname_for_the_location_relative_to_the_absolute_location_of_the_pathname ⇒ Object
- #test_find_should_return_nil_when_the_location_relative_to_the_absolute_location_of_the_pathname_is_not_a_file_or_does_not_exist ⇒ Object
- #test_parent_pathname_should_return_a_pathname_for_the_parent_directory ⇒ Object
- #test_source_file_should_return_a_source_file_for_the_pathname ⇒ Object
- #test_to_s_should_return_absolute_location ⇒ Object
Instance Method Details
#setup ⇒ Object
4 5 6 |
# File 'lib/sprockets/test/test_pathname.rb', line 4 def setup @environment = environment_for_fixtures end |
#test_absolute_location_is_automatically_expanded ⇒ Object
8 9 10 11 12 13 |
# File 'lib/sprockets/test/test_pathname.rb', line 8 def = File.(File.join(FIXTURES_PATH, "foo")) assert_absolute_location , pathname("foo") assert_absolute_location , pathname("./foo") assert_absolute_location , pathname("./foo/../foo") end |
#test_equality_of_pathnames ⇒ Object
34 35 36 37 38 |
# File 'lib/sprockets/test/test_pathname.rb', line 34 def test_equality_of_pathnames assert_equal pathname("src/foo.js"), pathname("src/foo.js") assert_equal pathname("src/foo.js"), pathname("src/foo/../foo.js") assert_not_equal pathname("src/foo.js"), pathname("src/foo/foo.js") end |
#test_find_should_return_a_pathname_for_the_location_relative_to_the_absolute_location_of_the_pathname ⇒ Object
15 16 17 |
# File 'lib/sprockets/test/test_pathname.rb', line 15 def test_find_should_return_a_pathname_for_the_location_relative_to_the_absolute_location_of_the_pathname assert_absolute_location_ends_with "src/foo/bar.js", pathname("src/foo").find("bar.js") end |
#test_find_should_return_nil_when_the_location_relative_to_the_absolute_location_of_the_pathname_is_not_a_file_or_does_not_exist ⇒ Object
19 20 21 |
# File 'lib/sprockets/test/test_pathname.rb', line 19 def test_find_should_return_nil_when_the_location_relative_to_the_absolute_location_of_the_pathname_is_not_a_file_or_does_not_exist assert_nil pathname("src/foo").find("nonexistent.js") end |
#test_parent_pathname_should_return_a_pathname_for_the_parent_directory ⇒ Object
23 24 25 26 |
# File 'lib/sprockets/test/test_pathname.rb', line 23 def test_parent_pathname_should_return_a_pathname_for_the_parent_directory assert_absolute_location_ends_with "src", pathname("src/foo").parent_pathname assert_absolute_location_ends_with "foo", pathname("src/foo/foo.js").parent_pathname end |
#test_source_file_should_return_a_source_file_for_the_pathname ⇒ Object
28 29 30 31 32 |
# File 'lib/sprockets/test/test_pathname.rb', line 28 def test_source_file_should_return_a_source_file_for_the_pathname source_file = pathname("src/foo.js").source_file assert_kind_of Sprockets::SourceFile, source_file assert_equal pathname("src/foo.js"), source_file.pathname end |
#test_to_s_should_return_absolute_location ⇒ Object
40 41 42 |
# File 'lib/sprockets/test/test_pathname.rb', line 40 def test_to_s_should_return_absolute_location assert_equal pathname("src/foo.js").to_s, pathname("src/foo.js").absolute_location end |