single_test 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.0
1
+ 0.5.1
data/lib/single_test.rb CHANGED
@@ -2,7 +2,6 @@ require 'rake'
2
2
 
3
3
  module SingleTest
4
4
  extend self
5
- include Rake::DSL
6
5
 
7
6
  CMD_LINE_MATCHER = /^(spec|test)\:.*(\:.*)?$/
8
7
 
@@ -81,7 +80,7 @@ module SingleTest
81
80
 
82
81
  def run_test(type, file, test_name=nil)
83
82
  case type.to_s
84
- when 'test' then sh "ruby -Ilib:test #{file} -n /#{test_name}/"
83
+ when 'test' then Rake.sh "ruby -Ilib:test #{file} -n /#{test_name}/"
85
84
  when 'spec' then
86
85
  executable = spec_executable
87
86
  options_file = "spec/spec.opts"
@@ -89,7 +88,7 @@ module SingleTest
89
88
  command = "export RAILS_ENV=test ; #{executable}#{options_file} #{file}"
90
89
  command += test_name_matcher(executable, file, test_name)
91
90
  command += " -X" if ENV['X'] # run via drb ?
92
- sh command
91
+ Rake.sh command
93
92
  else raise "Unknown: #{type}"
94
93
  end
95
94
  end
data/single_test.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "single_test"
8
- s.version = "0.5.0"
8
+ s.version = "0.5.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Michael Grosser"]
12
- s.date = "2012-03-07"
12
+ s.date = "2012-03-08"
13
13
  s.email = "grosser.michael@gmail.com"
14
14
  s.files = [
15
15
  "Gemfile",
@@ -156,63 +156,63 @@ describe SingleTest do
156
156
  end
157
157
 
158
158
  it "runs whole tests" do
159
- SingleTest.should_receive(:sh).with('ruby -Ilib:test xxx -n //')
159
+ Rake.should_receive(:sh).with('ruby -Ilib:test xxx -n //')
160
160
  SingleTest.run_test('test','xxx')
161
161
  end
162
162
 
163
163
  it "runs single tests on their own" do
164
- SingleTest.should_receive(:sh).with('ruby -Ilib:test xxx -n /yyy/')
164
+ Rake.should_receive(:sh).with('ruby -Ilib:test xxx -n /yyy/')
165
165
  SingleTest.run_test('test', 'xxx', 'yyy')
166
166
  end
167
167
 
168
168
  it "runs whole specs without -e" do
169
- SingleTest.should_receive(:sh).with('export RAILS_ENV=test ; script/spec xxx')
169
+ Rake.should_receive(:sh).with('export RAILS_ENV=test ; script/spec xxx')
170
170
  SingleTest.run_test('spec','xxx')
171
171
  end
172
172
 
173
173
  it "runs all matching specs through -e for rspec 2" do
174
174
  File.should_receive(:file?).with('script/spec').and_return false
175
175
  File.stub!(:readlines).and_return ['it "bla yyy" do']
176
- SingleTest.should_receive(:sh).with('export RAILS_ENV=test ; bundle exec rspec xxx -e "yyy"')
176
+ Rake.should_receive(:sh).with('export RAILS_ENV=test ; bundle exec rspec xxx -e "yyy"')
177
177
  SingleTest.run_test('spec','xxx', 'yyy')
178
178
  end
179
179
 
180
180
  it "runs full single specs through -e for rspec 1" do
181
181
  File.stub!(:readlines).and_return ['it "bla yyy" do']
182
- SingleTest.should_receive(:sh).with('export RAILS_ENV=test ; script/spec xxx -e "bla yyy"')
182
+ Rake.should_receive(:sh).with('export RAILS_ENV=test ; script/spec xxx -e "bla yyy"')
183
183
  SingleTest.run_test('spec','xxx', 'yyy')
184
184
  end
185
185
 
186
186
  it "runs single specs through -e with -X" do
187
187
  File.stub!(:readlines).and_return []
188
188
  ENV['X']=''
189
- SingleTest.should_receive(:sh).with('export RAILS_ENV=test ; script/spec xxx -e "yyy" -X')
189
+ Rake.should_receive(:sh).with('export RAILS_ENV=test ; script/spec xxx -e "yyy" -X')
190
190
  SingleTest.run_test('spec','xxx', 'yyy')
191
191
  end
192
192
 
193
193
  it "runs quoted specs though -e" do
194
194
  File.stub!(:readlines).and_return []
195
- SingleTest.should_receive(:sh).with(%Q(export RAILS_ENV=test ; script/spec xxx -e "y\\\"yy"))
195
+ Rake.should_receive(:sh).with(%Q(export RAILS_ENV=test ; script/spec xxx -e "y\\\"yy"))
196
196
  SingleTest.run_test('spec','xxx', 'y"yy')
197
197
  end
198
198
 
199
199
  it "adds --options if spec.opts file exists" do
200
200
  File.stub!(:exist?).and_return true
201
- SingleTest.should_receive(:sh).with('export RAILS_ENV=test ; script/spec --options spec/spec.opts xxx')
201
+ Rake.should_receive(:sh).with('export RAILS_ENV=test ; script/spec --options spec/spec.opts xxx')
202
202
  SingleTest.run_test('spec','xxx')
203
203
  end
204
204
 
205
205
  it "runs with bundled spec if script/spec is not found" do
206
206
  File.stub!(:file?).and_return false
207
207
  File.should_receive(:file?).with('script/spec').and_return false
208
- SingleTest.should_receive(:sh).with('export RAILS_ENV=test ; bundle exec rspec xxx')
208
+ Rake.should_receive(:sh).with('export RAILS_ENV=test ; bundle exec rspec xxx')
209
209
  SingleTest.run_test('spec','xxx')
210
210
  end
211
211
 
212
212
  it "uses bundler if Gemfile is present" do
213
213
  File.stub!(:file?).and_return false
214
214
  SingleTest.should_receive(:bundler_enabled?).and_return true
215
- SingleTest.should_receive(:sh).with('export RAILS_ENV=test ; bundle exec rspec xxx')
215
+ Rake.should_receive(:sh).with('export RAILS_ENV=test ; bundle exec rspec xxx')
216
216
  SingleTest.run_test('spec','xxx')
217
217
  end
218
218
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: single_test
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 0
10
- version: 0.5.0
9
+ - 1
10
+ version: 0.5.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Michael Grosser
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-03-07 00:00:00 Z
18
+ date: 2012-03-08 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  version_requirements: &id001 !ruby/object:Gem::Requirement