You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by do...@apache.org on 2013/10/27 21:26:19 UTC
svn commit: r1536192 - in /buildr/trunk/spec: core/common_spec.rb
core/compile_spec.rb java/test_coverage_helper.rb packaging/archive_spec.rb
Author: donaldp
Date: Sun Oct 27 20:26:19 2013
New Revision: 1536192
URL: http://svn.apache.org/r1536192
Log:
Replace deprecated_be_close(x,y) with be_within(y).of(x)
Modified:
buildr/trunk/spec/core/common_spec.rb
buildr/trunk/spec/core/compile_spec.rb
buildr/trunk/spec/java/test_coverage_helper.rb
buildr/trunk/spec/packaging/archive_spec.rb
Modified: buildr/trunk/spec/core/common_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/core/common_spec.rb?rev=1536192&r1=1536191&r2=1536192&view=diff
==============================================================================
--- buildr/trunk/spec/core/common_spec.rb (original)
+++ buildr/trunk/spec/core/common_spec.rb Sun Oct 27 20:26:19 2013
@@ -495,13 +495,13 @@ describe Buildr::Filter do
it 'should touch target directory' do
mkpath 'target' ; File.utime @early, @early, 'target'
@filter.from('src').into('target').run
- File.stat('target').mtime.should be_close(Time.now, 10)
+ File.stat('target').mtime.should be_within(10).of(Time.now)
end
it 'should not touch target directory unless running' do
mkpath 'target' ; File.utime @early, @early, 'target'
@filter.from('src').into('target').exclude('*').run
- File.mtime('target').should be_close(@early, 10)
+ File.mtime('target').should be_within(10).of(@early)
end
it 'should run only on new files' do
Modified: buildr/trunk/spec/core/compile_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/core/compile_spec.rb?rev=1536192&r1=1536191&r2=1536192&view=diff
==============================================================================
--- buildr/trunk/spec/core/compile_spec.rb (original)
+++ buildr/trunk/spec/core/compile_spec.rb Sun Oct 27 20:26:19 2013
@@ -389,21 +389,21 @@ describe Buildr::CompileTask, '#invoke'
time = now_at_fs_resolution - 10
mkpath compile_task.target.to_s
File.utime(time, time, compile_task.target.to_s)
- compile_task.timestamp.should be_close(time, 1)
+ compile_task.timestamp.should be_within(1).of(time)
end
it 'should touch target if anything compiled' do
mkpath compile_task.target.to_s
File.utime(now_at_fs_resolution - 10, now_at_fs_resolution - 10, compile_task.target.to_s)
compile_task.from(sources).invoke
- File.stat(compile_task.target.to_s).mtime.should be_close(now_at_fs_resolution, 2)
+ File.stat(compile_task.target.to_s).mtime.should be_within(2).of(now_at_fs_resolution)
end
it 'should not touch target if nothing compiled' do
mkpath compile_task.target.to_s
File.utime(now_at_fs_resolution - 10, now_at_fs_resolution - 10, compile_task.target.to_s)
compile_task.invoke
- File.stat(compile_task.target.to_s).mtime.should be_close(now_at_fs_resolution - 10, 2)
+ File.stat(compile_task.target.to_s).mtime.should be_within(2).of(now_at_fs_resolution - 10)
end
it 'should not touch target if failed to compile' do
@@ -411,7 +411,7 @@ describe Buildr::CompileTask, '#invoke'
File.utime(now_at_fs_resolution - 10, now_at_fs_resolution - 10, compile_task.target.to_s)
write 'failed.java', 'not a class'
suppress_stdout { compile_task.from('failed.java').invoke rescue nil }
- File.stat(compile_task.target.to_s).mtime.should be_close(now_at_fs_resolution - 10, 2)
+ File.stat(compile_task.target.to_s).mtime.should be_within(2).of(now_at_fs_resolution - 10)
end
it 'should complain if source directories and no compiler selected' do
@@ -429,7 +429,7 @@ describe Buildr::CompileTask, '#invoke'
touch 'target/classes/foo/Foo.class'
File.utime(now_at_fs_resolution - 10, now_at_fs_resolution - 10, compile_task.target.to_s)
compile_task.invoke
- File.stat(compile_task.target.to_s).mtime.should be_close(now_at_fs_resolution - 10, 2)
+ File.stat(compile_task.target.to_s).mtime.should be_within(2).of(now_at_fs_resolution - 10)
end
end
Modified: buildr/trunk/spec/java/test_coverage_helper.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/java/test_coverage_helper.rb?rev=1536192&r1=1536191&r2=1536192&view=diff
==============================================================================
--- buildr/trunk/spec/java/test_coverage_helper.rb (original)
+++ buildr/trunk/spec/java/test_coverage_helper.rb Sun Oct 27 20:26:19 2013
@@ -128,7 +128,7 @@ shared_examples_for 'test coverage tool'
mkpath instrumented_dir.to_s
File.utime(a_long_time_ago, a_long_time_ago, instrumented_dir.to_s)
task("foo:#{toolname}:instrument").invoke
- instrumented_dir.timestamp.should be_close(Time.now, 2)
+ instrumented_dir.timestamp.should be_within(2).of(Time.now)
end
it 'should not touch instrumented directory if nothing instrumented' do
@@ -137,7 +137,7 @@ shared_examples_for 'test coverage tool'
mkpath instrumented_dir.to_s
[project('foo').compile.target, instrumented_dir].map(&:to_s).each { |dir| File.utime(a_long_time_ago, a_long_time_ago, dir) }
task("foo:#{toolname}:instrument").invoke
- instrumented_dir.timestamp.should be_close(a_long_time_ago, 2)
+ instrumented_dir.timestamp.should be_within(2).of(a_long_time_ago)
end
end
Modified: buildr/trunk/spec/packaging/archive_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/packaging/archive_spec.rb?rev=1536192&r1=1536191&r2=1536192&view=diff
==============================================================================
--- buildr/trunk/spec/packaging/archive_spec.rb (original)
+++ buildr/trunk/spec/packaging/archive_spec.rb Sun Oct 27 20:26:19 2013
@@ -345,7 +345,7 @@ shared_examples_for 'ArchiveTask' do
# all included files newer.
File.utime Time.now - 100, Time.now - 100, @archive
archive(@archive).include(@files).invoke
- File.stat(@archive).mtime.should be_close(Time.now, 10)
+ File.stat(@archive).mtime.should be_within(10).of(Time.now)
end
it 'should update if a file in a subdir is more recent' do
@@ -369,7 +369,7 @@ shared_examples_for 'ArchiveTask' do
# By touching all files in the past, there's nothing new to update.
(@files + [@archive]).each { |f| File.utime Time.now - 100, Time.now - 100, f }
archive(@archive).include(@files).invoke
- File.stat(@archive).mtime.should be_close(Time.now - 100, 10)
+ File.stat(@archive).mtime.should be_within(10).of(Time.now - 100)
end
it 'should update if one of the files is recent' do
@@ -609,7 +609,7 @@ describe Unzip do
File.utime(Time.now - 10, Time.now - 10, @target)
unzip(@target=>@zip).target.invoke
end
- File.stat(@target).mtime.should be_close(Time.now, 2)
+ File.stat(@target).mtime.should be_within(2).of(Time.now)
end
it 'should expand files' do