This repository was archived by the owner on Nov 30, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +16
-12
lines changed Expand file tree Collapse file tree 4 files changed +16
-12
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,6 @@ Cucumber::Rake::Task.new(:cucumber)
28
28
desc "Run all examples"
29
29
RSpec ::Core ::RakeTask . new ( :spec ) do |t |
30
30
t . rspec_opts = %w[ --color ]
31
- t . verbose = false
32
31
end
33
32
34
33
if RUBY_VERSION . to_f == 1.8
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ Feature: rake task
20
20
end
21
21
"""
22
22
When I run `rake`
23
- Then the stderr should contain "ruby -S rspec"
23
+ Then the output should contain "ruby -S rspec"
24
24
Then the exit status should be 0
25
25
26
26
Scenario : default options with failing spec (exit status is 1)
Original file line number Diff line number Diff line change 1
- #!/usr/bin/env ruby
2
-
3
1
require 'rspec/core'
4
2
require 'rspec/core/deprecation'
5
3
require 'rake'
@@ -133,11 +131,12 @@ def initialize(*args)
133
131
puts "No examples matching #{ pattern } could be found"
134
132
else
135
133
begin
136
- ruby ( spec_command )
134
+ puts spec_command if verbose
135
+ success = system ( spec_command )
137
136
rescue
138
137
puts failure_message if failure_message
139
- raise ( "ruby #{ spec_command } failed" ) if fail_on_error
140
138
end
139
+ raise ( "ruby #{ spec_command } failed" ) if fail_on_error unless success
141
140
end
142
141
end
143
142
end
@@ -155,10 +154,12 @@ def files_to_run # :nodoc:
155
154
156
155
def spec_command
157
156
@spec_command ||= begin
158
- cmd_parts = [ ruby_opts ]
157
+ cmd_parts = [ ]
158
+ cmd_parts << "bundle exec" if gemfile? unless skip_bundler
159
+ cmd_parts << RUBY
160
+ cmd_parts << ruby_opts
159
161
cmd_parts << "-w" if warning?
160
162
cmd_parts << "-S"
161
- cmd_parts << "bundle exec" if gemfile? unless skip_bundler
162
163
cmd_parts << runner
163
164
if rcov
164
165
cmd_parts << [ "-Ispec#{ File ::PATH_SEPARATOR } lib" , rcov_opts ]
Original file line number Diff line number Diff line change @@ -5,6 +5,10 @@ module RSpec::Core
5
5
describe RakeTask do
6
6
let ( :task ) { RakeTask . new }
7
7
8
+ def ruby
9
+ FileUtils ::RUBY
10
+ end
11
+
8
12
before do
9
13
File . stub ( :exist? ) { false }
10
14
end
@@ -26,7 +30,7 @@ def spec_command
26
30
27
31
context "default" do
28
32
it "renders rspec" do
29
- spec_command . should =~ /^-S rspec/
33
+ spec_command . should =~ /^#{ ruby } -S rspec/
30
34
end
31
35
end
32
36
@@ -60,7 +64,7 @@ def spec_command
60
64
context "with rcov" do
61
65
it "renders rcov" do
62
66
with_rcov do
63
- spec_command . should =~ /^-S rcov/
67
+ spec_command . should =~ /^#{ ruby } -S rcov/
64
68
end
65
69
end
66
70
end
@@ -69,7 +73,7 @@ def spec_command
69
73
it "renders bundle exec rcov" do
70
74
with_bundler do
71
75
with_rcov do
72
- spec_command . should =~ /^-S bundle exec rcov/
76
+ spec_command . should =~ /^bundle exec #{ ruby } -S rcov/
73
77
end
74
78
end
75
79
end
@@ -78,7 +82,7 @@ def spec_command
78
82
context "with ruby options" do
79
83
it "renders them before -S" do
80
84
task . ruby_opts = "-w"
81
- spec_command . should =~ /^-w -S rspec/
85
+ spec_command . should =~ /^#{ ruby } -w -S rspec/
82
86
end
83
87
end
84
88
You can’t perform that action at this time.
0 commit comments