aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorRick Olson <technoweenie@gmail.com>2008-03-30 02:17:28 +0000
committerRick Olson <technoweenie@gmail.com>2008-03-30 02:17:28 +0000
commit088ef182e3006294b8f0e9b185d272a777c4437a (patch)
tree11b760af7a23bb5280f5aef5dc61350d0ea302f1 /railties/test
parent81286f858770e0b95e15af37f19156b044ec6a95 (diff)
downloadrails-088ef182e3006294b8f0e9b185d272a777c4437a.tar.gz
rails-088ef182e3006294b8f0e9b185d272a777c4437a.tar.bz2
rails-088ef182e3006294b8f0e9b185d272a777c4437a.zip
Added config.gem for specifying which gems are required by the application, as well as rake tasks for installing and freezing gems. [rick]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9140 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/gem_dependency_test.rb62
1 files changed, 62 insertions, 0 deletions
diff --git a/railties/test/gem_dependency_test.rb b/railties/test/gem_dependency_test.rb
new file mode 100644
index 0000000000..887ad53589
--- /dev/null
+++ b/railties/test/gem_dependency_test.rb
@@ -0,0 +1,62 @@
+require 'plugin_test_helper'
+
+uses_mocha "Plugin Tests" do
+ class GemDependencyTest < Test::Unit::TestCase
+ def setup
+ @gem = Rails::GemDependency.new "hpricot"
+ @gem_with_source = Rails::GemDependency.new "hpricot", :source => "http://code.whytheluckystiff.net"
+ @gem_with_version = Rails::GemDependency.new "hpricot", :version => "= 0.6"
+ @gem_with_lib = Rails::GemDependency.new "aws-s3", :lib => "aws/s3"
+ end
+
+ def test_configuration_adds_gem_dependency
+ config = Rails::Configuration.new
+ config.gem "aws-s3", :lib => "aws/s3", :version => "0.4.0"
+ assert_equal [["install", "aws-s3", "--version", "= 0.4.0"]], config.gems.collect(&:install_command)
+ end
+
+ def test_gem_creates_install_command
+ assert_equal %w(install hpricot), @gem.install_command
+ end
+
+ def test_gem_with_source_creates_install_command
+ assert_equal %w(install hpricot --source http://code.whytheluckystiff.net), @gem_with_source.install_command
+ end
+
+ def test_gem_with_version_creates_install_command
+ assert_equal ["install", "hpricot", "--version", "= 0.6"], @gem_with_version.install_command
+ end
+
+ def test_gem_creates_unpack_command
+ assert_equal %w(unpack hpricot), @gem.unpack_command
+ end
+
+ def test_gem_with_version_unpack_install_command
+ assert_equal ["unpack", "hpricot", "--version", "= 0.6"], @gem_with_version.unpack_command
+ end
+
+ def test_gem_adds_load_paths
+ @gem.expects(:gem).with(@gem.name)
+ @gem.add_load_paths
+ end
+
+ def test_gem_with_version_adds_load_paths
+ @gem_with_version.expects(:gem).with(@gem_with_version.name, @gem_with_version.requirement.to_s)
+ @gem_with_version.add_load_paths
+ end
+
+ def test_gem_loading
+ @gem.expects(:gem).with(@gem.name)
+ @gem.expects(:require).with(@gem.name)
+ @gem.add_load_paths
+ @gem.load
+ end
+
+ def test_gem_with_lib_loading
+ @gem_with_lib.expects(:gem).with(@gem_with_lib.name)
+ @gem_with_lib.expects(:require).with(@gem_with_lib.lib)
+ @gem_with_lib.add_load_paths
+ @gem_with_lib.load
+ end
+ end
+end \ No newline at end of file