mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
12d9be6b72
commit
c93ed570a2
11 changed files with 238 additions and 182 deletions
|
@ -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 @app.called
|
||||
@called
|
||||
end
|
||||
|
||||
def @app.method_missing(*a, &b)
|
||||
@called ||= []
|
||||
@called << [a, b]
|
||||
nil
|
||||
end
|
||||
|
||||
def teardown
|
||||
Rake.application = @app
|
||||
|
||||
super
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue