diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2009-04-30 13:29:33 +0100 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2009-04-30 13:29:33 +0100 |
commit | 5f24ed718f92abe97fc3f50a36c9fb09499d0173 (patch) | |
tree | d097bb0e59c4a31c262fe83081e396219e7186bd /railties/test/gem_dependency_test.rb | |
parent | 35ca877abc889d863747726e3da6e359ba928506 (diff) | |
parent | 79420e71e0e75d6f81e5284184bac4e7d0b02c30 (diff) | |
download | rails-5f24ed718f92abe97fc3f50a36c9fb09499d0173.tar.gz rails-5f24ed718f92abe97fc3f50a36c9fb09499d0173.tar.bz2 rails-5f24ed718f92abe97fc3f50a36c9fb09499d0173.zip |
Merge commit 'mainstream/master'
Diffstat (limited to 'railties/test/gem_dependency_test.rb')
-rw-r--r-- | railties/test/gem_dependency_test.rb | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/railties/test/gem_dependency_test.rb b/railties/test/gem_dependency_test.rb index d9cd5148a3..ff27af5572 100644 --- a/railties/test/gem_dependency_test.rb +++ b/railties/test/gem_dependency_test.rb @@ -1,4 +1,5 @@ require 'plugin_test_helper' +require 'rails/gem_dependency' class Rails::GemDependency public :install_command, :unpack_command @@ -144,4 +145,46 @@ class GemDependencyTest < Test::Unit::TestCase end end + def test_gem_ignores_development_dependencies + dummy_gem = Rails::GemDependency.new "dummy-gem-k" + dummy_gem.add_load_paths + dummy_gem.load + assert_equal 1, dummy_gem.dependencies.size + end + + def test_gem_guards_against_duplicate_unpacks + dummy_gem = Rails::GemDependency.new "dummy-gem-a" + dummy_gem.stubs(:frozen?).returns(true) + dummy_gem.expects(:unpack_base).never + dummy_gem.unpack + end + + def test_gem_does_not_unpack_framework_gems + dummy_gem = Rails::GemDependency.new "dummy-gem-a" + dummy_gem.stubs(:framework_gem?).returns(true) + dummy_gem.expects(:unpack_base).never + dummy_gem.unpack + end + + def test_gem_from_directory_name + dummy_gem = Rails::GemDependency.from_directory_name('dummy-gem-1.1') + assert_equal 'dummy-gem', dummy_gem.name + assert_equal '= 1.1', dummy_gem.version_requirements.to_s + end + + def test_gem_from_invalid_directory_name + assert_raises RuntimeError do + dummy_gem = Rails::GemDependency.from_directory_name('dummy-gem') + end + assert_raises RuntimeError do + dummy_gem = Rails::GemDependency.from_directory_name('dummy') + end + end + + def test_gem_determines_build_status + assert_equal true, Rails::GemDependency.new("dummy-gem-a").built? + assert_equal true, Rails::GemDependency.new("dummy-gem-i").built? + assert_equal false, Rails::GemDependency.new("dummy-gem-j").built? + end + end |