Author: donaldp
Date: Thu Sep 26 11:34:40 2013
New Revision: 1526447
URL: http://svn.apache.org/r1526447
Log:
Use more modern rspec constructs
Modified:
buildr/trunk/spec/core/application_spec.rb
buildr/trunk/spec/core/build_spec.rb
buildr/trunk/spec/core/common_spec.rb
buildr/trunk/spec/core/test_spec.rb
buildr/trunk/spec/core/transport_spec.rb
Modified: buildr/trunk/spec/core/application_spec.rb
URL:
http://svn.apache.org/viewvc/buildr/trunk/spec/core/application_spec.rb?rev=1526447&r1=1526446&r2=1526447&view=diff
==============================================================================
--- buildr/trunk/spec/core/application_spec.rb (original)
+++ buildr/trunk/spec/core/application_spec.rb Thu Sep 26 11:34:40 2013
@@ -33,7 +33,7 @@ describe Buildr::Application do
it 'should execute *_load methods in order' do
order = [:load_gems, :load_artifact_ns, :load_tasks, :raw_load_buildfile]
order.each { |method| Buildr.application.should_receive(method).ordered }
- Buildr.application.stub!(:exit) # With this, shows the correct error
instead of SystemExit.
+ Buildr.application.stub(:exit) # With this, shows the correct error
instead of SystemExit.
Buildr.application.run
end
@@ -43,7 +43,7 @@ describe Buildr::Application do
Buildr.application.should_receive(:load_imports)
method.call
end
- Buildr.application.stub!(:exit) # With this, shows the correct error
instead of SystemExit.
+ Buildr.application.stub(:exit) # With this, shows the correct error
instead of SystemExit.
Buildr.application.run
end
@@ -51,7 +51,7 @@ describe Buildr::Application do
Buildr.application.should_receive(:load_imports) do
Buildr.should_receive(:projects)
end
- Buildr.application.stub!(:exit) # With this, shows the correct error
instead of SystemExit.
+ Buildr.application.stub(:exit) # With this, shows the correct error
instead of SystemExit.
Buildr.application.run
end
end
@@ -174,7 +174,7 @@ describe Buildr::Application do
spec.name = 'buildr-foo'
spec.version = '1.2'
end
- $stdout.stub!(:isatty).and_return(true)
+ $stdout.stub(:isatty).and_return(true)
end
it 'should do nothing if no gems specified' do
@@ -495,19 +495,19 @@ describe Buildr, 'settings' do
end
it 'should have the same timestamp as the buildfile' do
- Buildr.application.buildfile.timestamp.should be_close(@buildfile_time,
1)
+ Buildr.application.buildfile.timestamp.should
be_within(1).of(@buildfile_time)
end
it 'should have the same timestamp as build.yaml if the latter is newer' do
write 'build.yaml'; File.utime(@buildfile_time + 5, @buildfile_time + 5,
'build.yaml')
Buildr.application.run
- Buildr.application.buildfile.timestamp.should be_close(@buildfile_time +
5, 1)
+ Buildr.application.buildfile.timestamp.should
be_within(1).of(@buildfile_time + 5)
end
it 'should have the same timestamp as the buildfile if build.yaml is
older' do
write 'build.yaml'; File.utime(@buildfile_time - 5, @buildfile_time - 5,
'build.yaml')
Buildr.application.run
- Buildr.application.buildfile.timestamp.should be_close(@buildfile_time,
1)
+ Buildr.application.buildfile.timestamp.should
be_within(1).of(@buildfile_time)
end
it 'should have the same timestamp as build.rb in home dir if the latter
is newer (until version 1.6)' do
@@ -530,7 +530,7 @@ describe Buildr, 'settings' do
def buildfile_should_have_same_timestamp_as(file)
write file; File.utime(@buildfile_time + 5, @buildfile_time + 5, file)
Buildr.application.send :load_tasks
- Buildr.application.buildfile.timestamp.should be_close(@buildfile_time +
5, 1)
+ Buildr.application.buildfile.timestamp.should
be_within(1).of(@buildfile_time + 5)
end
end
end
Modified: buildr/trunk/spec/core/build_spec.rb
URL:
http://svn.apache.org/viewvc/buildr/trunk/spec/core/build_spec.rb?rev=1526447&r1=1526446&r2=1526447&view=diff
==============================================================================
--- buildr/trunk/spec/core/build_spec.rb (original)
+++ buildr/trunk/spec/core/build_spec.rb Thu Sep 26 11:34:40 2013
@@ -335,16 +335,16 @@ end # of Git
describe Svn do
describe '#tag' do
it 'should remove any existing tag with the same name' do
- Svn.stub!(:repo_url).and_return('http://my.repo.org/foo/trunk')
- Svn.stub!(:copy)
+ Svn.stub(:repo_url).and_return('http://my.repo.org/foo/trunk')
+ Svn.stub(:copy)
Svn.should_receive(:remove).with('http://my.repo.org/foo/tags/1.0.0',
'Removing old copy')
Svn.tag '1.0.0'
end
it 'should do an svn copy with the release version' do
- Svn.stub!(:repo_url).and_return('http://my.repo.org/foo/trunk')
- Svn.stub!(:remove)
+ Svn.stub(:repo_url).and_return('http://my.repo.org/foo/trunk')
+ Svn.stub(:remove)
Svn.should_receive(:copy).with(Dir.pwd,
'http://my.repo.org/foo/tags/1.0.0', 'Release 1.0.0')
Svn.tag '1.0.0'
@@ -444,47 +444,47 @@ shared_examples_for 'a release process'
before do
write 'buildfile', "VERSION_NUMBER = '1.0.0-SNAPSHOT'"
# Prevent a real call to a spawned buildr process.
- @release.stub!(:buildr)
- @release.stub!(:check)
+ @release.stub(:buildr)
+ @release.stub(:check)
@release.should_receive(:ruby).with('-S', 'buildr',
"_#{Buildr::VERSION}_", '--buildfile', File.expand_path('buildfile.next'),
'--environment', 'development',
'clean', 'upload', 'DEBUG=no')
end
it 'should tag a release with the release version' do
- @release.stub!(:update_version_to_next)
+ @release.stub(:update_version_to_next)
@release.should_receive(:tag_release).with('1.0.0')
@release.make
end
it 'should not alter the buildfile before tagging' do
- @release.stub!(:update_version_to_next)
+ @release.stub(:update_version_to_next)
@release.should_receive(:tag_release).with('1.0.0')
@release.make
file('buildfile').should contain('VERSION_NUMBER = "1.0.0"')
end
it 'should update the buildfile with the next version number' do
- @release.stub!(:tag_release)
+ @release.stub(:tag_release)
@release.make
file('buildfile').should contain('VERSION_NUMBER = "1.0.1-SNAPSHOT"')
end
it 'should keep leading zeros in the next version number' do
write 'buildfile', "VERSION_NUMBER = '1.0.001-SNAPSHOT'"
- @release.stub!(:tag_release)
+ @release.stub(:tag_release)
@release.make
file('buildfile').should contain('VERSION_NUMBER = "1.0.002-SNAPSHOT"')
end
it 'should commit the updated buildfile' do
- @release.stub!(:tag_release)
+ @release.stub(:tag_release)
@release.make
file('buildfile').should contain('VERSION_NUMBER = "1.0.1-SNAPSHOT"')
end
it 'should not consider "-rc" as "-SNAPSHOT"' do
write 'buildfile', "VERSION_NUMBER = '1.0.0-rc1'"
- @release.stub!(:tag_release)
+ @release.stub(:tag_release)
@release.make
file('buildfile').should contain('VERSION_NUMBER = "1.0.0-rc1"')
end
@@ -492,7 +492,7 @@ shared_examples_for 'a release process'
it 'should only commit the updated buildfile if the version changed' do
write 'buildfile', "VERSION_NUMBER = '1.0.0-rc1'"
@release.should_not_receive(:update_version_to_next)
- @release.stub!(:tag_release)
+ @release.stub(:tag_release)
@release.make
end
end
@@ -631,7 +631,7 @@ shared_examples_for 'a release process'
describe '#resolve_tag' do
before do
- @release.stub!(:extract_version).and_return('1.0.0')
+ @release.stub(:extract_version).and_return('1.0.0')
end
it 'should return tag specified by tag_name' do
@@ -648,7 +648,7 @@ shared_examples_for 'a release process'
describe '#tag_release' do
it 'should inform the user' do
- @release.stub!(:extract_version).and_return('1.0.0')
+ @release.stub(:extract_version).and_return('1.0.0')
lambda { @release.tag_release('1.0.0') }.should show_info('Tagging
release 1.0.0')
end
end
@@ -682,7 +682,7 @@ shared_examples_for 'a release process'
describe '#with_release_candidate_version' do
before do
- Buildr.application.stub!(:buildfile).and_return(file('buildfile'))
+ Buildr.application.stub(:buildfile).and_return(file('buildfile'))
write 'buildfile', "THIS_VERSION = '1.1.0-SNAPSHOT'"
end
@@ -741,7 +741,7 @@ shared_examples_for 'a release process'
describe '#check' do
before { @release.send(:this_version=, "1.0.0-SNAPSHOT") }
it 'should fail if THIS_VERSION equals the next_version' do
- @release.stub!(:resolve_next_version).and_return('1.0.0-SNAPSHOT')
+ @release.stub(:resolve_next_version).and_return('1.0.0-SNAPSHOT')
lambda { @release.check }.should raise_error("The next version can't be
equal to the current version 1.0.0-SNAPSHOT.\nUpdate
THIS_VERSION/VERSION_NUMBER, specify Release.next_version or use NEXT_VERSION
env var")
end
end
@@ -754,9 +754,9 @@ describe HgRelease do
before do
write 'buildfile', "VERSION_NUMBER = '1.0.0-SNAPSHOT'"
@release = HgRelease.new
- Hg.stub!(:hg)
- Hg.stub!(:remote).and_return('https://bitbucket.org/sample-repo')
- Hg.stub!(:current_branch).and_return('default')
+ Hg.stub(:hg)
+ Hg.stub(:remote).and_return('https://bitbucket.org/sample-repo')
+ Hg.stub(:current_branch).and_return('default')
end
describe '#applies_to?' do
@@ -806,8 +806,8 @@ describe GitRelease do
before do
write 'buildfile', "VERSION_NUMBER = '1.0.0-SNAPSHOT'"
@release = GitRelease.new
- Git.stub!(:git)
- Git.stub!(:current_branch).and_return('master')
+ Git.stub(:git)
+ Git.stub(:current_branch).and_return('master')
end
describe '#applies_to?' do
@@ -866,13 +866,13 @@ EOF
describe '#tag_release' do
before do
@release = GitRelease.new
- @release.stub!(:extract_version).and_return('1.0.1')
- @release.stub!(:resolve_tag).and_return('TEST_TAG')
- Git.stub!(:git).with('tag', '-a', 'TEST_TAG', '-m', '[buildr] Cutting
release TEST_TAG')
- Git.stub!(:git).with('push', 'origin', 'tag', 'TEST_TAG')
- Git.stub!(:commit)
- Git.stub!(:push)
- Git.stub!(:remote).and_return('origin')
+ @release.stub(:extract_version).and_return('1.0.1')
+ @release.stub(:resolve_tag).and_return('TEST_TAG')
+ Git.stub(:git).with('tag', '-a', 'TEST_TAG', '-m', '[buildr] Cutting
release TEST_TAG')
+ Git.stub(:git).with('push', 'origin', 'tag', 'TEST_TAG')
+ Git.stub(:commit)
+ Git.stub(:push)
+ Git.stub(:remote).and_return('origin')
end
it 'should delete any existing tag with the same name' do
@@ -895,7 +895,7 @@ EOF
end
it 'should NOT push the tag if no remote is tracked' do
- Git.stub!(:remote).and_return(nil)
+ Git.stub(:remote).and_return(nil)
Git.should_not_receive(:git).with('push', 'origin', 'tag', 'TEST_TAG')
@release.tag_release 'TEST_TAG'
end
@@ -909,9 +909,9 @@ describe SvnRelease do
before do
write 'buildfile', "VERSION_NUMBER = '1.0.0-SNAPSHOT'"
@release = SvnRelease.new
- Svn.stub!(:svn)
- Svn.stub!(:repo_url).and_return('http://my.repo.org/foo/trunk')
- Svn.stub!(:tag)
+ Svn.stub(:svn)
+ Svn.stub(:repo_url).and_return('http://my.repo.org/foo/trunk')
+ Svn.stub(:tag)
end
describe '#applies_to?' do
@@ -927,34 +927,34 @@ describe SvnRelease do
describe '#check' do
before do
- Svn.stub!(:uncommitted_files).and_return([])
+ Svn.stub(:uncommitted_files).and_return([])
@release = SvnRelease.new
@release.send(:this_version=, "1.0.0-SNAPSHOT")
end
it 'should accept to release from the trunk' do
- Svn.stub!(:repo_url).and_return('http://my.repo.org/foo/trunk')
+ Svn.stub(:repo_url).and_return('http://my.repo.org/foo/trunk')
lambda { @release.check }.should_not raise_error
end
it 'should accept to release from a branch' do
- Svn.stub!(:repo_url).and_return('http://my.repo.org/foo/branches/1.0')
+ Svn.stub(:repo_url).and_return('http://my.repo.org/foo/branches/1.0')
lambda { @release.check }.should_not raise_error
end
it 'should reject releasing from a tag' do
- Svn.stub!(:repo_url).and_return('http://my.repo.org/foo/tags/1.0.0')
+ Svn.stub(:repo_url).and_return('http://my.repo.org/foo/tags/1.0.0')
lambda { @release.check }.should raise_error(RuntimeError, "SVN URL must
contain 'trunk' or 'branches/...'")
end
it 'should reject a non standard repository layout' do
- Svn.stub!(:repo_url).and_return('http://my.repo.org/foo/bar')
+ Svn.stub(:repo_url).and_return('http://my.repo.org/foo/bar')
lambda { @release.check }.should raise_error(RuntimeError, "SVN URL must
contain 'trunk' or 'branches/...'")
end
it 'should reject an uncommitted file' do
- Svn.stub!(:repo_url).and_return('http://my.repo.org/foo/trunk')
- Svn.stub!(:uncommitted_files).and_return(['foo.rb'])
+ Svn.stub(:repo_url).and_return('http://my.repo.org/foo/trunk')
+ Svn.stub(:uncommitted_files).and_return(['foo.rb'])
lambda { @release.check }.should raise_error(RuntimeError,
"Uncommitted files violate the First Principle Of Release!\n" +
"foo.rb")
Modified: buildr/trunk/spec/core/common_spec.rb
URL:
http://svn.apache.org/viewvc/buildr/trunk/spec/core/common_spec.rb?rev=1526447&r1=1526446&r2=1526447&view=diff
==============================================================================
--- buildr/trunk/spec/core/common_spec.rb (original)
+++ buildr/trunk/spec/core/common_spec.rb Thu Sep 26 11:34:40 2013
@@ -98,7 +98,7 @@ describe Buildr.method(:download) do
before do
@content = 'we has download!'
@http = mock('http')
- @http.stub!(:request).and_return(Net::HTTPNotModified.new(nil, nil, nil))
+ @http.stub(:request).and_return(Net::HTTPNotModified.new(nil, nil, nil))
end
def tasks()
@@ -602,7 +602,7 @@ describe Buildr::Options, 'proxy.exclude
@no_proxy_args = [@host, 80]
@proxy_args = @no_proxy_args + ['myproxy', 8080, nil, nil]
@http = mock('http')
- @http.stub!(:request).and_return(Net::HTTPNotModified.new(nil, nil, nil))
+ @http.stub(:request).and_return(Net::HTTPNotModified.new(nil, nil, nil))
end
it 'should be an array' do
Modified: buildr/trunk/spec/core/test_spec.rb
URL:
http://svn.apache.org/viewvc/buildr/trunk/spec/core/test_spec.rb?rev=1526447&r1=1526446&r2=1526447&view=diff
==============================================================================
--- buildr/trunk/spec/core/test_spec.rb (original)
+++ buildr/trunk/spec/core/test_spec.rb Thu Sep 26 11:34:40 2013
@@ -322,8 +322,8 @@ describe Buildr::TestTask, 'with passing
define 'foo' do
test.using(:junit)
test.instance_eval do
- @framework.stub!(:tests).and_return(['PassingTest1', 'PassingTest2'])
- @framework.stub!(:run).and_return(['PassingTest1', 'PassingTest2'])
+ @framework.stub(:tests).and_return(['PassingTest1', 'PassingTest2'])
+ @framework.stub(:run).and_return(['PassingTest1', 'PassingTest2'])
end
end
project('foo').test
@@ -367,8 +367,8 @@ describe Buildr::TestTask, 'with failed
define 'foo' do
test.using(:junit)
test.instance_eval do
- @framework.stub!(:tests).and_return(['FailingTest', 'PassingTest'])
- @framework.stub!(:run).and_return(['PassingTest'])
+ @framework.stub(:tests).and_return(['FailingTest', 'PassingTest'])
+ @framework.stub(:run).and_return(['PassingTest'])
end
end
project('foo').test
@@ -633,8 +633,8 @@ describe Buildr::TestTask, '#invoke' do
@test_task ||= define('foo') {
test.using(:junit)
test.instance_eval do
- @framework.stub!(:tests).and_return(['PassingTest'])
- @framework.stub!(:run).and_return(['PassingTest'])
+ @framework.stub(:tests).and_return(['PassingTest'])
+ @framework.stub(:run).and_return(['PassingTest'])
end
}.test
end
@@ -844,10 +844,10 @@ describe 'test rule' do
it 'should reset tasks to specific pattern' do
define 'foo' do
test.using(:junit)
- test.instance_eval { @framework.stub!(:tests).and_return(['something',
'nothing']) }
+ test.instance_eval { @framework.stub(:tests).and_return(['something',
'nothing']) }
define 'bar' do
test.using(:junit)
- test.instance_eval { @framework.stub!(:tests).and_return(['something',
'nothing']) }
+ test.instance_eval { @framework.stub(:tests).and_return(['something',
'nothing']) }
end
end
task('test:something').invoke
@@ -860,7 +860,7 @@ describe 'test rule' do
it 'should apply *name* pattern' do
define 'foo' do
test.using(:junit)
- test.instance_eval {
@framework.stub!(:tests).and_return(['prefix-something-suffix']) }
+ test.instance_eval {
@framework.stub(:tests).and_return(['prefix-something-suffix']) }
end
task('test:something').invoke
project('foo').test.tests.should include('prefix-something-suffix')
@@ -869,7 +869,7 @@ describe 'test rule' do
it 'should not apply *name* pattern if asterisks used' do
define 'foo' do
test.using(:junit)
- test.instance_eval {
@framework.stub!(:tests).and_return(['prefix-something',
'prefix-something-suffix']) }
+ test.instance_eval {
@framework.stub(:tests).and_return(['prefix-something',
'prefix-something-suffix']) }
end
task('test:*something').invoke
project('foo').test.tests.should include('prefix-something')
@@ -879,7 +879,7 @@ describe 'test rule' do
it 'should accept multiple tasks separated by commas' do
define 'foo' do
test.using(:junit)
- test.instance_eval { @framework.stub!(:tests).and_return(['foo', 'bar',
'baz']) }
+ test.instance_eval { @framework.stub(:tests).and_return(['foo', 'bar',
'baz']) }
end
task('test:foo,bar').invoke
project('foo').test.tests.should include('foo')
@@ -899,7 +899,7 @@ describe 'test rule' do
it 'should execute the named tests even if the test task is not needed' do
define 'foo' do
test.using(:junit)
- test.instance_eval { @framework.stub!(:tests).and_return(['something',
'nothing']) }
+ test.instance_eval { @framework.stub(:tests).and_return(['something',
'nothing']) }
end
touch_last_successful_test_run project('foo').test
task('test:something').invoke
@@ -909,7 +909,7 @@ describe 'test rule' do
it 'should not execute excluded tests' do
define 'foo' do
test.using(:junit)
- test.instance_eval { @framework.stub!(:tests).and_return(['something',
'nothing']) }
+ test.instance_eval { @framework.stub(:tests).and_return(['something',
'nothing']) }
end
task('test:*,-nothing').invoke
project('foo').test.tests.should include('something')
@@ -932,7 +932,7 @@ describe 'test rule' do
it 'should not execute excluded tests with wildcards' do
define 'foo' do
test.using(:junit)
- test.instance_eval { @framework.stub!(:tests).and_return(['something',
'nothing']) }
+ test.instance_eval { @framework.stub(:tests).and_return(['something',
'nothing']) }
end
task('test:something,-s*,-n*').invoke
project('foo').test.tests.should_not include('something')
@@ -942,7 +942,7 @@ describe 'test rule' do
it 'should execute all tests except excluded tests' do
define 'foo' do
test.using(:junit)
- test.instance_eval { @framework.stub!(:tests).and_return(['something',
'anything', 'nothing']) }
+ test.instance_eval { @framework.stub(:tests).and_return(['something',
'anything', 'nothing']) }
end
task('test:-nothing').invoke
project('foo').test.tests.should include('something', 'anything')
@@ -953,7 +953,7 @@ describe 'test rule' do
define 'foo' do
test.using(:junit)
test.exclude 'something'
- test.instance_eval { @framework.stub!(:tests).and_return(['something',
'anything', 'nothing']) }
+ test.instance_eval { @framework.stub(:tests).and_return(['something',
'anything', 'nothing']) }
end
task('test:-nothing').invoke
project('foo').test.tests.should include('something', 'anything')
@@ -964,7 +964,7 @@ describe 'test rule' do
define 'foo' do
test.using(:junit)
test.include 'something'
- test.instance_eval { @framework.stub!(:tests).and_return(['something',
'nothing']) }
+ test.instance_eval { @framework.stub(:tests).and_return(['something',
'nothing']) }
end
task('test:nothing').invoke
project('foo').test.tests.should include('nothing')
@@ -974,7 +974,7 @@ describe 'test rule' do
it 'should not execute a test if it''s both included and excluded' do
define 'foo' do
test.using(:junit)
- test.instance_eval { @framework.stub!(:tests).and_return(['nothing']) }
+ test.instance_eval { @framework.stub(:tests).and_return(['nothing']) }
end
task('test:nothing,-nothing').invoke
project('foo').test.tests.should_not include('nothing')
@@ -983,7 +983,7 @@ describe 'test rule' do
it 'should not update the last successful test run timestamp' do
define 'foo' do
test.using(:junit)
- test.instance_eval { @framework.stub!(:tests).and_return(['something',
'nothing']) }
+ test.instance_eval { @framework.stub(:tests).and_return(['something',
'nothing']) }
end
a_second_ago = Time.now - 1
touch_last_successful_test_run project('foo').test, a_second_ago
@@ -1000,8 +1000,8 @@ describe 'test failed' do
define 'foo' do
test.using(:junit)
test.instance_eval do
- @framework.stub!(:tests).and_return(['FailingTest', 'PassingTest'])
- @framework.stub!(:run).and_return(['PassingTest'])
+ @framework.stub(:tests).and_return(['FailingTest', 'PassingTest'])
+ @framework.stub(:run).and_return(['PassingTest'])
end
end
project('foo').test
@@ -1012,8 +1012,8 @@ describe 'test failed' do
define 'foo' do
test.using(:junit)
test.instance_eval do
- @framework.stub!(:tests).and_return(['FailingTest', 'PassingTest'])
- @framework.stub!(:run).and_return(['PassingTest'])
+ @framework.stub(:tests).and_return(['FailingTest', 'PassingTest'])
+ @framework.stub(:run).and_return(['PassingTest'])
end
end
write project('foo').path_to(:target, "junit-failed"), "FailingTest"
@@ -1026,8 +1026,8 @@ describe 'test failed' do
define 'foo' do
test.using(:junit).exclude('ExcludedTest')
test.instance_eval do
- @framework.stub!(:tests).and_return(['FailingTest', 'PassingTest',
'ExcludedTest'])
- @framework.stub!(:run).and_return(['PassingTest'])
+ @framework.stub(:tests).and_return(['FailingTest', 'PassingTest',
'ExcludedTest'])
+ @framework.stub(:run).and_return(['PassingTest'])
end
end
write project('foo').path_to(:target, "junit-failed"),
"FailingTest\nExcludedTest"
@@ -1041,16 +1041,16 @@ describe 'test failed' do
define 'foo' do
test.using(:junit)
test.instance_eval do
- @framework.stub!(:tests).and_return(['PassingTest'])
- @framework.stub!(:run).and_return(['PassingTest'])
+ @framework.stub(:tests).and_return(['PassingTest'])
+ @framework.stub(:run).and_return(['PassingTest'])
end
end
define 'bar' do
test.using(:junit)
test.enhance ["parent:foo:test"]
test.instance_eval do
- @framework.stub!(:tests).and_return(['FailingTest', 'PassingTest'])
- @framework.stub!(:run).and_return(['PassingTest'])
+ @framework.stub(:tests).and_return(['FailingTest', 'PassingTest'])
+ @framework.stub(:run).and_return(['PassingTest'])
end
end
end
@@ -1268,10 +1268,10 @@ describe 'integration rule' do
it 'should reset tasks to specific pattern' do
define 'foo' do
test.using :junit, :integration
- test.instance_eval { @framework.stub!(:tests).and_return(['something',
'nothing']) }
+ test.instance_eval { @framework.stub(:tests).and_return(['something',
'nothing']) }
define 'bar' do
test.using :junit, :integration
- test.instance_eval { @framework.stub!(:tests).and_return(['something',
'nothing']) }
+ test.instance_eval { @framework.stub(:tests).and_return(['something',
'nothing']) }
end
end
task('integration:something').invoke
@@ -1284,7 +1284,7 @@ describe 'integration rule' do
it 'should apply *name* pattern' do
define 'foo' do
test.using :junit, :integration
- test.instance_eval {
@framework.stub!(:tests).and_return(['prefix-something-suffix']) }
+ test.instance_eval {
@framework.stub(:tests).and_return(['prefix-something-suffix']) }
end
task('integration:something').invoke
project('foo').test.tests.should include('prefix-something-suffix')
@@ -1293,7 +1293,7 @@ describe 'integration rule' do
it 'should not apply *name* pattern if asterisks used' do
define 'foo' do
test.using :junit, :integration
- test.instance_eval {
@framework.stub!(:tests).and_return(['prefix-something',
'prefix-something-suffix']) }
+ test.instance_eval {
@framework.stub(:tests).and_return(['prefix-something',
'prefix-something-suffix']) }
end
task('integration:*something').invoke
project('foo').test.tests.should include('prefix-something')
@@ -1303,7 +1303,7 @@ describe 'integration rule' do
it 'should accept multiple tasks separated by commas' do
define 'foo' do
test.using :junit, :integration
- test.instance_eval { @framework.stub!(:tests).and_return(['foo', 'bar',
'baz']) }
+ test.instance_eval { @framework.stub(:tests).and_return(['foo', 'bar',
'baz']) }
end
task('integration:foo,bar').invoke
project('foo').test.tests.should include('foo')
Modified: buildr/trunk/spec/core/transport_spec.rb
URL:
http://svn.apache.org/viewvc/buildr/trunk/spec/core/transport_spec.rb?rev=1526447&r1=1526446&r2=1526447&view=diff
==============================================================================
--- buildr/trunk/spec/core/transport_spec.rb (original)
+++ buildr/trunk/spec/core/transport_spec.rb Thu Sep 26 11:34:40 2013
@@ -238,7 +238,7 @@ describe URI::HTTP, '#read' do
@no_proxy_args = [@host_domain, 80]
@proxy_args = @no_proxy_args + ['myproxy', 8080, 'john', 'smith']
@http = mock('http')
- @http.stub!(:request).and_yield(Net::HTTPNotModified.new(nil, nil, nil))
+ @http.stub(:request).and_yield(Net::HTTPNotModified.new(nil, nil, nil))
end
it 'should not use proxy unless proxy is set' do
@@ -309,8 +309,8 @@ describe URI::HTTP, '#read' do
it 'should not die if content size is zero' do
ok = Net::HTTPOK.new(nil, nil, nil)
- ok.stub!(:read_body)
- @http.stub!(:request).and_yield(ok)
+ ok.stub(:read_body)
+ @http.stub(:request).and_yield(ok)
Net::HTTP.should_receive(:new).and_return(@http)
$stdout.should_receive(:isatty).and_return(false)
@uri.read :progress=>true
@@ -338,7 +338,7 @@ describe URI::HTTP, '#read' do
# The second request will be ok
ok = Net::HTTPOK.new(nil, nil, nil)
- ok.stub!(:read_body)
+ ok.stub(:read_body)
request2 = mock('request2')
Net::HTTP::Get.should_receive(:new).once.with("/asdf",
default_http_headers).and_return(request2)
@@ -350,7 +350,7 @@ describe URI::HTTP, '#read' do
it 'should include the query part when performing HTTP GET' do
# should this test be generalized or shared with any other URI subtypes?
- Net::HTTP.stub!(:new).and_return(@http)
+ Net::HTTP.stub(:new).and_return(@http)
Net::HTTP::Get.should_receive(:new).with(/#{Regexp.escape(@query)}$/,
default_http_headers)
@uri.read
end
@@ -363,8 +363,8 @@ describe URI::HTTP, '#write' do
@content = 'Readme. Please!'
@uri = URI('http://john:[email protected]/foo/bar/baz.jar')
@http = mock('Net::HTTP')
- @http.stub!(:request).and_return(Net::HTTPOK.new(nil, nil, nil))
- Net::HTTP.stub!(:new).and_return(@http)
+ @http.stub(:request).and_return(Net::HTTPOK.new(nil, nil, nil))
+ Net::HTTP.stub(:new).and_return(@http)
end
it 'should open connection to HTTP server' do
@@ -441,12 +441,12 @@ describe URI::SFTP, '#read' do
@ssh_session = mock('Net::SSH::Session')
@sftp_session = mock('Net::SFTP::Session')
@file_factory = mock('Net::SFTP::Operations::FileFactory')
- Net::SSH.stub!(:start).with('localhost', 'john', :password=>'secret',
:port=>22).and_return(@ssh_session) do
+ Net::SSH.stub(:start).with('localhost', 'john', :password=>'secret',
:port=>22).and_return(@ssh_session) do
Net::SFTP::Session.should_receive(:new).with(@ssh_session).and_yield(@sftp_session).and_return(@sftp_session)
@sftp_session.should_receive(:connect!).and_return(@sftp_session)
@sftp_session.should_receive(:loop)
@sftp_session.should_receive(:file).with.and_return(@file_factory)
- @file_factory.stub!(:open)
+ @file_factory.stub(:open)
@ssh_session.should_receive(:close)
@ssh_session
end
@@ -489,15 +489,15 @@ describe URI::SFTP, '#write' do
@ssh_session = mock('Net::SSH::Session')
@sftp_session = mock('Net::SFTP::Session')
@file_factory = mock('Net::SFTP::Operations::FileFactory')
- Net::SSH.stub!(:start).with('localhost', 'john', :password=>'secret',
:port=>22).and_return(@ssh_session) do
+ Net::SSH.stub(:start).with('localhost', 'john', :password=>'secret',
:port=>22).and_return(@ssh_session) do
Net::SFTP::Session.should_receive(:new).with(@ssh_session).and_yield(@sftp_session).and_return(@sftp_session)
@sftp_session.should_receive(:connect!).and_return(@sftp_session)
@sftp_session.should_receive(:loop)
- @sftp_session.stub!(:opendir!).and_return { fail }
- @sftp_session.stub!(:close)
- @sftp_session.stub!(:mkdir!)
+ @sftp_session.stub(:opendir!).and_return { fail }
+ @sftp_session.stub(:close)
+ @sftp_session.stub(:mkdir!)
@sftp_session.should_receive(:file).with.and_return(@file_factory)
- @file_factory.stub!(:open)
+ @file_factory.stub(:open)
@ssh_session.should_receive(:close)
@ssh_session
end