whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@apache.org
Subject [whimsy] 03/04: on second thought, don't commit
Date Fri, 10 Jun 2016 14:59:31 GMT
This is an automated email from the ASF dual-hosted git repository.

rubys pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/whimsy.git

commit 7b73e204be865765353f1457a52b9966ec1f9db0
Author: Sam Ruby <rubys@intertwingly.net>
AuthorDate: Fri Jun 10 10:19:25 2016 -0400

    on second thought, don't commit
    
    tests shouldn't make changes that might affect other tests
---
 lib/whimsy/asf/svn.rb                   |  4 ++--
 www/board/agenda/spec/actions_spec.rb   |  6 ++++--
 www/board/agenda/spec/secretary_spec.rb | 19 +++++--------------
 www/board/agenda/spec/spec_helper.rb    |  9 ++++++---
 4 files changed, 17 insertions(+), 21 deletions(-)

diff --git a/lib/whimsy/asf/svn.rb b/lib/whimsy/asf/svn.rb
index 5375830..f83eb25 100644
--- a/lib/whimsy/asf/svn.rb
+++ b/lib/whimsy/asf/svn.rb
@@ -162,9 +162,9 @@ module ASF
           rc = _.system ['svn', 'diff', tmpfile]
         else
           # commit the changes
-          rc = _.system ['svn', 'commit', '--message', msg.untaint,
+          rc = _.system ['svn', 'commit', tmpfile || tmpdir,
             ['--username', env.user, '--password', env.password],
-            tmpfile || tmpdir]
+            '--message', msg.untaint]
         end
 
         # fail if there are pending changes
diff --git a/www/board/agenda/spec/actions_spec.rb b/www/board/agenda/spec/actions_spec.rb
index 4e6fd8f..5d52492 100644
--- a/www/board/agenda/spec/actions_spec.rb
+++ b/www/board/agenda/spec/actions_spec.rb
@@ -369,8 +369,10 @@ feature 'server actions' do
       File.unlink 'test/work/data/test.bak'
     end
 
-    @cleanup.each do |file| 
-      Agenda[File.basename(file)].replace :mtime=>0
+    if @commits
+      @commits.each do |name, contents| 
+        Agenda[name].replace :mtime=>0
+      end
     end
   end
 end
diff --git a/www/board/agenda/spec/secretary_spec.rb b/www/board/agenda/spec/secretary_spec.rb
index 3484ba9..14c1696 100644
--- a/www/board/agenda/spec/secretary_spec.rb
+++ b/www/board/agenda/spec/secretary_spec.rb
@@ -89,20 +89,11 @@ feature 'report' do
       @message = 'Draft minutes for 2015-02-18'
       @text = draft
 
-      file = "#{FOUNDATION_BOARD}/board_minutes_2015_02_18.txt"
-
-      begin
-        eval(File.read('views/actions/draft.json.rb'), nil, 'draft.json.rb')
-
-        system 'svn', 'update', file
-        expect(File.exist? file).to be true
-        expect(File.read file).to eq draft
-      ensure
-        if File.exist? file
-          `svn rm #{file}`
-          `svn commit #{file} -m cleanup`
-        end
-      end
+      eval(File.read('views/actions/draft.json.rb'), nil, 'draft.json.rb')
+
+      minutes = @agenda.sub('_agenda_', '_minutes_')
+      expect(@commits).to include(minutes)
+      expect(@commits[minutes]).to eq draft
     end
   end
 
diff --git a/www/board/agenda/spec/spec_helper.rb b/www/board/agenda/spec/spec_helper.rb
index 15c867d..e8dcc20 100644
--- a/www/board/agenda/spec/spec_helper.rb
+++ b/www/board/agenda/spec/spec_helper.rb
@@ -50,14 +50,17 @@ module MockServer
   # intercept commits, adding the files to the cleanup list
   def system(*args)
     args.flatten!
-    if args[1] == 'commit' and @cleanup
-      @cleanup <<= args[2]
+    if args[1] == 'commit'
+      @commits ||= {}
+      @commits[File.basename args[2]] = File.read(args[2])
+      `svn revert #{args[2]}`
+      0
     else
       args.reject! {|arg| Array === arg}
       @transcript ||= ''
       @transcript += `#{Shellwords.join(args)}`
+      $?.exitstatus
     end
-    0
   end
 end
 

-- 
To stop receiving notification emails like this one, please contact
"commits@whimsical.apache.org" <commits@whimsical.apache.org>.

Mime
View raw message