diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-07-23 05:38:50 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-07-23 05:38:50 +0000 |
commit | c93ed570a2991f5ec059526941f442eadacc3cb1 (patch) | |
tree | cb70e0ff69911e3e49ba770fc49dcb12813b7185 /test/rake/test_rake_top_level_functions.rb | |
parent | 12d9be6b727bdfe605fc65f18659c4cb4d4b283c (diff) | |
download | ruby-c93ed570a2991f5ec059526941f442eadacc3cb1.tar.gz |
* test/rake*: Remove dependencies on flexmock and session gems.
[Ruby 1.9 - Bug #4987]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32636 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rake/test_rake_top_level_functions.rb')
-rw-r--r-- | test/rake/test_rake_top_level_functions.rb | 69 |
1 files changed, 52 insertions, 17 deletions
diff --git a/test/rake/test_rake_top_level_functions.rb b/test/rake/test_rake_top_level_functions.rb index 69ef8691fb..1ed1af02e3 100644 --- a/test/rake/test_rake_top_level_functions.rb +++ b/test/rake/test_rake_top_level_functions.rb @@ -5,28 +5,43 @@ class TestRakeTopLevelFunctions < Rake::TestCase def setup super - @app = Rake.application - Rake.application = flexmock("app") - Rake.application.should_receive(:deprecate). - and_return { |old, new, call| @app.deprecate(old, new, call) } - end + @app = Object.new - def teardown - Rake.application = @app + def @app.called + @called + end - super + def @app.method_missing(*a, &b) + @called ||= [] + @called << [a, b] + nil + end + + Rake.application = @app end def test_namespace - Rake.application.should_receive(:in_namespace).with("xyz", any).once - namespace "xyz" do end + block = proc do end + + namespace("xyz", &block) + + expected = [ + [[:in_namespace, 'xyz'], block] + ] + + assert_equal expected, @app.called end def test_import - Rake.application.should_receive(:add_import).with("x").once.ordered - Rake.application.should_receive(:add_import).with("y").once.ordered - Rake.application.should_receive(:add_import).with("z").once.ordered import('x', 'y', 'z') + + expected = [ + [[:add_import, 'x'], nil], + [[:add_import, 'y'], nil], + [[:add_import, 'z'], nil], + ] + + assert_equal expected, @app.called end def test_when_writing @@ -51,23 +66,43 @@ class TestRakeTopLevelFunctions < Rake::TestCase end def test_missing_constants_task - Rake.application.should_receive(:const_warning).with(:Task).once Object.const_missing(:Task) + + expected = [ + [[:const_warning, :Task], nil] + ] + + assert_equal expected, @app.called end def test_missing_constants_file_task - Rake.application.should_receive(:const_warning).with(:FileTask).once Object.const_missing(:FileTask) + + expected = [ + [[:const_warning, :FileTask], nil] + ] + + assert_equal expected, @app.called end def test_missing_constants_file_creation_task - Rake.application.should_receive(:const_warning).with(:FileCreationTask).once Object.const_missing(:FileCreationTask) + + expected = [ + [[:const_warning, :FileCreationTask], nil] + ] + + assert_equal expected, @app.called end def test_missing_constants_rake_app - Rake.application.should_receive(:const_warning).with(:RakeApp).once Object.const_missing(:RakeApp) + + expected = [ + [[:const_warning, :RakeApp], nil] + ] + + assert_equal expected, @app.called end def test_missing_other_constant |