You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by vb...@apache.org on 2008/09/24 21:17:39 UTC

svn commit: r698694 - in /incubator/buildr/trunk/spec: core/application_spec.rb packaging/artifact_spec.rb

Author: vborja
Date: Wed Sep 24 12:17:39 2008
New Revision: 698694

URL: http://svn.apache.org/viewvc?rev=698694&view=rev
Log:
Specs for Buildr::Application#load_* private methods and the order they should be run.

Modified:
    incubator/buildr/trunk/spec/core/application_spec.rb
    incubator/buildr/trunk/spec/packaging/artifact_spec.rb

Modified: incubator/buildr/trunk/spec/core/application_spec.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/spec/core/application_spec.rb?rev=698694&r1=698693&r2=698694&view=diff
==============================================================================
--- incubator/buildr/trunk/spec/core/application_spec.rb (original)
+++ incubator/buildr/trunk/spec/core/application_spec.rb Wed Sep 24 12:17:39 2008
@@ -29,6 +29,21 @@
     end
   end
 
+  describe '#run' do
+    it 'should execute *_load methods in order' do
+      last = nil
+      order = [:load_requires, :find_buildfile, :load_gems, :load_artifacts, 
+               :load_tasks, :load_buildfile, :load_imports, :top_level]
+      order.each_with_index do |method, idx|
+        Buildr.application.should_receive(method) do
+          last.should == (idx == 0 ? nil : order[idx-1])
+          last = method
+        end
+      end
+      Buildr.application.run
+    end
+  end
+
   describe 'environment' do
     it 'should return value of BUILDR_ENV' do
       ENV['BUILDR_ENV'] = 'qa'
@@ -47,7 +62,7 @@
     
     it 'should be echoed to user' do
       write 'buildfile'
-      lambda { Buildr.application.load_buildfile }.should show_info(%r{(in .*, development)})
+      lambda { Buildr.application.send :load_buildfile }.should show_info(%r{(in .*, development)})
     end
     
     after do
@@ -56,6 +71,13 @@
   end
 
   describe 'gems' do
+    before do
+      Buildr.application.private_methods(true).should include('load_gems')
+      class << Buildr.application
+        public :load_gems
+      end
+    end
+
     def load_with_yaml
       write 'build.yaml', <<-YAML
         gems:
@@ -94,6 +116,10 @@
 
   describe 'load_gems' do
     before do
+      Buildr.application.private_methods(true).should include('load_gems')
+      class << Buildr.application
+        public :load_gems
+      end
       @spec = Gem::Specification.new do |spec|
         spec.name = 'foo'
         spec.version = '1.2'

Modified: incubator/buildr/trunk/spec/packaging/artifact_spec.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/spec/packaging/artifact_spec.rb?rev=698694&r1=698693&r2=698694&view=diff
==============================================================================
--- incubator/buildr/trunk/spec/packaging/artifact_spec.rb (original)
+++ incubator/buildr/trunk/spec/packaging/artifact_spec.rb Wed Sep 24 12:17:39 2008
@@ -430,7 +430,7 @@
       artifacts: 
         j2ee: geronimo-spec:geronimo-spec-j2ee:jar:1.4-rc4
     YAML
-    Buildr.application.load_artifacts
+    Buildr.application.send :load_artifacts
     artifact(:j2ee).to_s.pathmap('%f').should == 'geronimo-spec-j2ee-1.4-rc4.jar'
   end
 end