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 2014/07/31 07:12:33 UTC

[19/50] git commit: Replace deprecated_be_close(x, y) with be_within(y).of(x)

Replace deprecated_be_close(x,y) with be_within(y).of(x)

git-svn-id: https://svn.apache.org/repos/asf/buildr/trunk@1536192 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/buildr/repo
Commit: http://git-wip-us.apache.org/repos/asf/buildr/commit/6fb423f7
Tree: http://git-wip-us.apache.org/repos/asf/buildr/tree/6fb423f7
Diff: http://git-wip-us.apache.org/repos/asf/buildr/diff/6fb423f7

Branch: refs/heads/master
Commit: 6fb423f7055a0e767feaff77d44f517b2b3e9dfa
Parents: 47048bc
Author: Peter Donald <do...@apache.org>
Authored: Sun Oct 27 20:26:19 2013 +0000
Committer: Peter Donald <do...@apache.org>
Committed: Sun Oct 27 20:26:19 2013 +0000

----------------------------------------------------------------------
 spec/core/common_spec.rb          |  4 ++--
 spec/core/compile_spec.rb         | 10 +++++-----
 spec/java/test_coverage_helper.rb |  4 ++--
 spec/packaging/archive_spec.rb    |  6 +++---
 4 files changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/buildr/blob/6fb423f7/spec/core/common_spec.rb
----------------------------------------------------------------------
diff --git a/spec/core/common_spec.rb b/spec/core/common_spec.rb
index c741b34..a72d1bb 100644
--- a/spec/core/common_spec.rb
+++ b/spec/core/common_spec.rb
@@ -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

http://git-wip-us.apache.org/repos/asf/buildr/blob/6fb423f7/spec/core/compile_spec.rb
----------------------------------------------------------------------
diff --git a/spec/core/compile_spec.rb b/spec/core/compile_spec.rb
index d4d6383..08fba32 100644
--- a/spec/core/compile_spec.rb
+++ b/spec/core/compile_spec.rb
@@ -389,21 +389,21 @@ describe Buildr::CompileTask, '#invoke' do
     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' do
     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' do
     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
 

http://git-wip-us.apache.org/repos/asf/buildr/blob/6fb423f7/spec/java/test_coverage_helper.rb
----------------------------------------------------------------------
diff --git a/spec/java/test_coverage_helper.rb b/spec/java/test_coverage_helper.rb
index 3b555d1..1651c97 100644
--- a/spec/java/test_coverage_helper.rb
+++ b/spec/java/test_coverage_helper.rb
@@ -128,7 +128,7 @@ shared_examples_for 'test coverage tool' do
         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' do
         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
 

http://git-wip-us.apache.org/repos/asf/buildr/blob/6fb423f7/spec/packaging/archive_spec.rb
----------------------------------------------------------------------
diff --git a/spec/packaging/archive_spec.rb b/spec/packaging/archive_spec.rb
index 1b82c1f..42d7e47 100644
--- a/spec/packaging/archive_spec.rb
+++ b/spec/packaging/archive_spec.rb
@@ -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