public
Fork of dchelimsky/rspec
Description: Behaviour Driven Development framework for Ruby
Homepage: http://rspec.info
Clone URL: git://github.com/jpshackelford/rspec.git
removed spec_command from autotest/rspec (ruby works just fine)
dchelimsky (author)
Sat Jul 12 16:09:07 -0700 2008
commit  1aca72d0c5b5dc92c1ac9a4b94ccb8f6961067d2
tree    e7191449c0477a483c292c2325d8fee7cd2de0ce
parent  74fd2a7e6893e95a6d4706b1dcf209e436cf7d1e
...
36
37
38
39
 
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
...
36
37
38
 
39
40
41
42
43
44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
0
@@ -36,37 +36,10 @@ class Autotest::Rspec < Autotest
0
   end
0
 
0
   def make_test_cmd(files_to_test)
0
-    return "#{ruby} -S #{spec_command} #{add_options_if_present} #{files_to_test.keys.flatten.join(' ')}"
0
+    return "#{ruby} -S #{files_to_test.keys.flatten.join(' ')} #{add_options_if_present}"
0
   end
0
   
0
   def add_options_if_present # :nodoc:
0
     File.exist?("spec/spec.opts") ? "-O spec/spec.opts " : ""
0
   end
0
-
0
-  # Finds the proper spec command to use.  Precendence is set in the
0
-  # lazily-evaluated method spec_commands.  Alias + Override that in
0
-  # ~/.autotest to provide a different spec command then the default
0
-  # paths provided.
0
-  def spec_command(separator=File::ALT_SEPARATOR)
0
-    unless defined? @spec_command then
0
-      @spec_command = spec_commands.find { |cmd| File.exists? cmd }
0
-
0
-      raise RspecCommandError, "No spec command could be found!" unless @spec_command
0
-
0
-      @spec_command.gsub! File::SEPARATOR, separator if separator
0
-    end
0
-    @spec_command
0
-  end
0
-
0
-  # Autotest will look for spec commands in the following
0
-  # locations, in this order:
0
-  #
0
-  #   * bin/spec
0
-  #   * default spec bin/loader installed in Rubygems
0
-  def spec_commands
0
-    [
0
-      File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'bin', 'spec')),
0
-      File.join(Config::CONFIG['bindir'], 'spec')
0
-    ]
0
-  end
0
 end
...
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
...
116
117
118
119
120
121
122
...
126
127
128
129
130
131
132
133
134
135
136
137
138
 
139
140
141
...
37
38
39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
41
42
...
60
61
62
 
63
64
65
...
69
70
71
 
 
 
 
 
 
 
72
73
 
74
75
76
77
0
@@ -37,62 +37,6 @@ HERE
0
   end
0
 
0
   describe Rspec do
0
-    describe "selection of rspec command" do
0
-      include AutotestHelper
0
-    
0
-      before(:each) do
0
-        common_setup
0
-        @rspec_autotest = Rspec.new
0
-      end
0
-    
0
-      it "should try to find the spec command if it exists in ./bin and use it above everything else" do
0
-        File.stub!(:exists?).and_return true
0
-
0
-        spec_path = File.expand_path("#{File.dirname(__FILE__)}/../../bin/spec")
0
-        File.should_receive(:exists?).with(spec_path).and_return true
0
-        @rspec_autotest.spec_command.should == spec_path
0
-      end
0
-
0
-      it "should otherwise select the default spec command in gem_dir/bin/spec" do
0
-        @rspec_autotest.stub!(:spec_commands).and_return ["/foo/spec"]
0
-        Config::CONFIG.stub!(:[]).and_return "/foo"
0
-        File.should_receive(:exists?).with("/foo/spec").and_return(true)
0
-
0
-        @rspec_autotest.spec_command.should == "/foo/spec"
0
-      end
0
-    
0
-      it "should raise an error if no spec command is found at all" do
0
-        File.stub!(:exists?).and_return false
0
-      
0
-        lambda {
0
-          @rspec_autotest.spec_command
0
-        }.should raise_error(RspecCommandError, "No spec command could be found!")
0
-      end
0
-    end
0
-    
0
-    describe "selection of rspec command (windows compatibility issues)" do
0
-      include AutotestHelper
0
-    
0
-      before(:each) do
0
-        common_setup
0
-      end
0
-    
0
-      it "should use the ALT_SEPARATOR if it is non-nil" do
0
-        @rspec_autotest = Rspec.new
0
-        spec_command = File.expand_path("#{File.dirname(__FILE__)}/../../bin/spec")
0
-        @rspec_autotest.stub!(:spec_commands).and_return [spec_command]
0
-        @rspec_autotest.spec_command(@windows_alt_separator).should == spec_command.gsub('/', @windows_alt_separator)
0
-      end
0
-    
0
-      it "should not use the ALT_SEPATOR if it is nil" do
0
-        @windows_alt_separator = nil
0
-        @rspec_autotest = Rspec.new
0
-        spec_command = File.expand_path("#{File.dirname(__FILE__)}/../../bin/spec")
0
-        @rspec_autotest.stub!(:spec_commands).and_return [spec_command]
0
-        @rspec_autotest.spec_command.should == spec_command
0
-      end
0
-    end
0
-
0
     describe "adding spec.opts --options" do 
0
       before(:each) do
0
         @rspec_autotest = Rspec.new
0
@@ -116,7 +60,6 @@ HERE
0
         @rspec_autotest.stub!(:add_options_if_present).and_return "-O spec/spec.opts"
0
       
0
         @ruby = @rspec_autotest.ruby
0
-        @spec_command = @rspec_autotest.spec_command
0
         @options = @rspec_autotest.add_options_if_present
0
         @files_to_test = {
0
           :spec => ["file_one", "file_two"]
0
@@ -126,16 +69,9 @@ HERE
0
         @files_to_test.stub!(:keys).and_return @files_to_test[:spec]
0
         @to_test = @files_to_test.keys.flatten.join ' '
0
       end
0
-
0
-      it "should contain the various commands, ordered by preference" do
0
-        Rspec.new.spec_commands.should == [
0
-          File.expand_path("#{File.dirname(__FILE__)}/../../bin/spec"),
0
-          "#{Config::CONFIG['bindir']}/spec"
0
-        ]
0
-      end
0
     
0
       it "should make the apropriate test command" do
0
-        @rspec_autotest.make_test_cmd(@files_to_test).should == "#{@ruby} -S #{@spec_command} #{@options} #{@to_test}"
0
+        @rspec_autotest.make_test_cmd(@files_to_test).should == "#{@ruby} -S #{@to_test} #{@options}"
0
       end
0
     end
0
   

Comments