guard-sporkminitest 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gemspec +1 -1
- data/Gemfile +1 -1
- data/Guardfile +1 -1
- data/Rakefile +2 -54
- data/lib/guard/sporkminitest.rb +6 -13
- data/lib/guard/sporkminitest/notifier.rb +1 -0
- data/lib/guard/sporkminitest/runner.rb +1 -62
- data/lib/guard/sporkminitest/runners/default_runner.rb +2 -5
- data/lib/guard/sporkminitest/runners/version_1_runner.rb +3 -2
- data/lib/guard/sporkminitest/runners/version_2_runner.rb +1 -1
- data/lib/guard/sporkminitest/version.rb +1 -4
- data/spec/guard/{minitest → sporkminitest}/inspector_spec.rb +2 -2
- data/spec/guard/{minitest → sporkminitest}/notifier_spec.rb +3 -3
- data/spec/guard/sporkminitest/runner_spec.rb +30 -0
- data/spec/guard/{minitest_spec.rb → sporkminitest_spec.rb} +11 -31
- data/spec/spec_helper.rb +1 -1
- metadata +10 -10
- data/spec/guard/minitest/runner_spec.rb +0 -175
data/.gemspec
CHANGED
@@ -4,7 +4,7 @@ require 'guard/sporkminitest/version'
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |gem|
|
6
6
|
gem.name = 'guard-sporkminitest'
|
7
|
-
gem.version = Guard::
|
7
|
+
gem.version = Guard::SporkMinitestVERSION
|
8
8
|
gem.authors = ['Yann Lugrin', '☈king']
|
9
9
|
gem.email = ['rking-guard-sporkminitest@sharpsaw.org']
|
10
10
|
gem.homepage = 'https://github.com/rking/guard-minitest'
|
data/Gemfile
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
source
|
1
|
+
source :rubygems
|
2
2
|
gemspec
|
data/Guardfile
CHANGED
data/Rakefile
CHANGED
@@ -3,6 +3,8 @@ Bundler::GemHelper.install_tasks
|
|
3
3
|
|
4
4
|
require 'minitest/unit'
|
5
5
|
|
6
|
+
task :default => :test
|
7
|
+
|
6
8
|
desc 'Run all tests'
|
7
9
|
task :test do
|
8
10
|
ENV['QUIET'] ||= 'true'
|
@@ -15,57 +17,3 @@ task :test do
|
|
15
17
|
test_files = Dir['spec/**/*_spec.rb']
|
16
18
|
test_files.each { |f| require f }
|
17
19
|
end
|
18
|
-
|
19
|
-
task :default => :test
|
20
|
-
|
21
|
-
require 'rbconfig'
|
22
|
-
namespace(:test) do
|
23
|
-
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/i
|
24
|
-
desc "Run all specs on multiple ruby versions (requires pik)"
|
25
|
-
task(:portability) do
|
26
|
-
puts 'minitest can\'t be tested on MS Windows for now'
|
27
|
-
end
|
28
|
-
else
|
29
|
-
desc "Run all specs on multiple ruby versions (requires rvm)"
|
30
|
-
task(:portability) do
|
31
|
-
travis_config_file = File.expand_path("../.travis.yml", __FILE__)
|
32
|
-
begin
|
33
|
-
travis_options ||= YAML::load_file(travis_config_file)
|
34
|
-
rescue => ex
|
35
|
-
puts "Travis config file '#{travis_config_file}' could not be found: #{ex.message}"
|
36
|
-
return
|
37
|
-
end
|
38
|
-
|
39
|
-
travis_options['rvm'].each do |version|
|
40
|
-
system <<-BASH
|
41
|
-
bash -c 'source ~/.rvm/scripts/rvm;
|
42
|
-
rvm #{version};
|
43
|
-
ruby_version_string_size=`ruby -v | wc -m`
|
44
|
-
echo;
|
45
|
-
for ((c=1; c<$ruby_version_string_size+21; c++)); do echo -n "="; done
|
46
|
-
echo;
|
47
|
-
echo "minitest version 1 - `ruby -v`";
|
48
|
-
for ((c=1; c<$ruby_version_string_size+21; c++)); do echo -n "="; done
|
49
|
-
echo;
|
50
|
-
BUNDLE_GEMFILE=./gemfiles/minitest-1.7 bundle install;
|
51
|
-
BUNDLE_GEMFILE=./gemfiles/minitest-1.7 bundle exec rake test 2>&1'
|
52
|
-
BASH
|
53
|
-
if version =~ /^1\.9/
|
54
|
-
system <<-BASH
|
55
|
-
bash -c 'source ~/.rvm/scripts/rvm;
|
56
|
-
rvm #{version};
|
57
|
-
ruby_version_string_size=`ruby -v | wc -m`
|
58
|
-
echo;
|
59
|
-
for ((c=1; c<$ruby_version_string_size+21; c++)); do echo -n "="; done
|
60
|
-
echo;
|
61
|
-
echo "minitest version 2 - `ruby -v`";
|
62
|
-
for ((c=1; c<$ruby_version_string_size+21; c++)); do echo -n "="; done
|
63
|
-
echo;
|
64
|
-
BUNDLE_GEMFILE=./gemfiles/minitest-2.1 bundle install;
|
65
|
-
BUNDLE_GEMFILE=./gemfiles/minitest-2.1 bundle exec rake test 2>&1'
|
66
|
-
BASH
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
data/lib/guard/sporkminitest.rb
CHANGED
@@ -4,9 +4,10 @@ require 'guard/guard'
|
|
4
4
|
|
5
5
|
module Guard
|
6
6
|
class SporkMinitest < Guard
|
7
|
+
VERSION = '0.0.2'
|
7
8
|
|
8
|
-
|
9
|
-
|
9
|
+
require 'guard/sporkminitest/runner'
|
10
|
+
require 'guard/sporkminitest/inspector'
|
10
11
|
|
11
12
|
def initialize(watchers = [], options = {})
|
12
13
|
super
|
@@ -15,17 +16,9 @@ module Guard
|
|
15
16
|
@inspector = Inspector.new(@runner.test_folders, @runner.test_file_patterns)
|
16
17
|
end
|
17
18
|
|
18
|
-
def start
|
19
|
-
|
20
|
-
end
|
21
|
-
|
22
|
-
def stop
|
23
|
-
true
|
24
|
-
end
|
25
|
-
|
26
|
-
def reload
|
27
|
-
true
|
28
|
-
end
|
19
|
+
def start; true end
|
20
|
+
def stop; true end
|
21
|
+
def reload; true end
|
29
22
|
|
30
23
|
def run_all
|
31
24
|
paths = @inspector.clean_all
|
@@ -5,6 +5,7 @@ module Guard
|
|
5
5
|
class SporkMinitestNotifier
|
6
6
|
|
7
7
|
def self.guard_message(test_count, assertion_count, failure_count, error_count, skip_count, duration)
|
8
|
+
# TODO: use a dang Hash
|
8
9
|
message = "#{test_count} examples, #{assertion_count} assertions, #{failure_count} failures, #{error_count} errors"
|
9
10
|
if skip_count > 0
|
10
11
|
message << " (#{skip_count} skips)"
|
@@ -12,12 +12,7 @@ module Guard
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def initialize(options = {})
|
15
|
-
parse_deprecated_options(options)
|
16
|
-
|
17
15
|
@options = {
|
18
|
-
:bundler => File.exist?("#{Dir.pwd}/Gemfile"),
|
19
|
-
:rubygems => false,
|
20
|
-
:drb => false,
|
21
16
|
:test_folders => %w[test spec],
|
22
17
|
:test_file_patterns => %w[*_test.rb test_*.rb *_spec.rb],
|
23
18
|
:cli => ''
|
@@ -31,25 +26,13 @@ module Guard
|
|
31
26
|
def run(paths, options = {})
|
32
27
|
message = options[:message] || "Running: #{paths.join(' ')}"
|
33
28
|
UI.info message, :reset => true
|
34
|
-
system
|
29
|
+
system 'testdrb', *paths
|
35
30
|
end
|
36
31
|
|
37
32
|
def cli_options
|
38
33
|
@options[:cli] ||= ''
|
39
34
|
end
|
40
35
|
|
41
|
-
def bundler?
|
42
|
-
@options[:bundler]
|
43
|
-
end
|
44
|
-
|
45
|
-
def rubygems?
|
46
|
-
!bundler? && @options[:rubygems]
|
47
|
-
end
|
48
|
-
|
49
|
-
def drb?
|
50
|
-
@options[:drb]
|
51
|
-
end
|
52
|
-
|
53
36
|
def test_folders
|
54
37
|
@options[:test_folders]
|
55
38
|
end
|
@@ -58,50 +41,6 @@ module Guard
|
|
58
41
|
@options[:test_file_patterns]
|
59
42
|
end
|
60
43
|
|
61
|
-
private
|
62
|
-
|
63
|
-
def minitest_command(paths)
|
64
|
-
cmd_parts = []
|
65
|
-
|
66
|
-
# Does nothing but slow things down. Please correct me if I'm wrong:
|
67
|
-
# cmd_parts << "bundle exec" if bundler?
|
68
|
-
if drb?
|
69
|
-
cmd_parts << 'testdrb'
|
70
|
-
cmd_parts += paths.map{ |path| "./#{path}" }
|
71
|
-
else
|
72
|
-
# TODO: nuke this branch
|
73
|
-
cmd_parts << 'ruby'
|
74
|
-
cmd_parts += test_folders.map{|f| %[-I"#{f}"] }
|
75
|
-
cmd_parts << '-r rubygems' if rubygems?
|
76
|
-
cmd_parts << '-r bundler/setup' if bundler?
|
77
|
-
cmd_parts += paths.map{ |path| "-r ./#{path}" }
|
78
|
-
cmd_parts << "-r #{File.expand_path('../runners/default_runner.rb', __FILE__)}"
|
79
|
-
cmd_parts << '-e \'MiniTest::Unit.autorun\''
|
80
|
-
cmd_parts << '--' << cli_options unless cli_options.empty?
|
81
|
-
end
|
82
|
-
|
83
|
-
cmd_parts.join(' ')
|
84
|
-
end
|
85
|
-
|
86
|
-
def parse_deprecated_options(options)
|
87
|
-
options[:cli] ||= ''
|
88
|
-
|
89
|
-
# TODO remove this
|
90
|
-
if options.key?(:notify)
|
91
|
-
UI.info %{DEPRECATION WARNING: The :notify option is deprecated. Guard notification configuration is used.}
|
92
|
-
end
|
93
|
-
|
94
|
-
[:seed, :verbose].each do |key|
|
95
|
-
if value = options.delete(key)
|
96
|
-
options[:cli] << " --#{key}"
|
97
|
-
if ![TrueClass, FalseClass].include?(value.class)
|
98
|
-
options[:cli] << " #{value}"
|
99
|
-
end
|
100
|
-
|
101
|
-
UI.info %{DEPRECATION WARNING: The :#{key} option is deprecated. Pass standard command line argument "--#{key}" to MiniTest with the :cli option.}
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
105
44
|
end
|
106
45
|
end
|
107
46
|
end
|
@@ -1,8 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require 'minitest/unit'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
else
|
7
|
-
load File.expand_path('../version_2_runner.rb', __FILE__)
|
8
|
-
end
|
4
|
+
warn "TODO: inline version_2_runner"
|
5
|
+
load File.expand_path('../version_2_runner.rb', __FILE__)
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require 'minitest/unit'
|
3
|
-
|
3
|
+
|
4
|
+
require 'guard/sporkminitest/notifier'
|
4
5
|
|
5
6
|
module MiniTest
|
6
7
|
class MiniTest::Unit
|
@@ -10,7 +11,7 @@ module MiniTest
|
|
10
11
|
start = Time.now
|
11
12
|
run_without_guard(args)
|
12
13
|
duration = Time.now - start
|
13
|
-
::Guard::
|
14
|
+
::Guard::SporkMinitestNotifier.notify(test_count, assertion_count, failures, errors, skips, duration)
|
14
15
|
end
|
15
16
|
|
16
17
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
|
-
describe Guard::
|
5
|
-
subject { Guard::
|
4
|
+
describe Guard::SporkMinitest::Inspector do
|
5
|
+
subject { Guard::SporkMinitest::Inspector.new(%w[test spec], %w[*_test.rb test_*.rb *_spec.rb]) }
|
6
6
|
|
7
7
|
describe 'clean' do
|
8
8
|
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require 'spec_helper'
|
3
|
-
require 'guard/
|
3
|
+
require 'guard/sporkminitest/notifier'
|
4
4
|
|
5
|
-
describe Guard::
|
6
|
-
subject { Guard::
|
5
|
+
describe 'Guard::SporkMinitestNotifier' do
|
6
|
+
subject { Guard::SporkMinitestNotifier }
|
7
7
|
|
8
8
|
it 'should format message without skipped test' do
|
9
9
|
message = subject.guard_message(1, 2, 3, 4, 0, 10.0)
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
describe Guard::SporkMinitest::Runner do
|
4
|
+
subject { Guard::SporkMinitest::Runner }
|
5
|
+
|
6
|
+
describe 'options' do
|
7
|
+
describe 'cli_options' do
|
8
|
+
it 'default should be empty string' do
|
9
|
+
subject.new.cli_options.must_equal ''
|
10
|
+
end
|
11
|
+
it 'should be set with \'cli\'' do
|
12
|
+
subject.new(:cli => '--test').cli_options.must_equal '--test'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe 'run' do
|
18
|
+
before(:each) do
|
19
|
+
Dir.stubs(:pwd).returns(fixtures_path.join('empty'))
|
20
|
+
end
|
21
|
+
describe 'drb' do
|
22
|
+
it 'should run with drb' do
|
23
|
+
runner = subject.new(:test_folders => %w[test], :drb => true)
|
24
|
+
Guard::UI.expects(:info)
|
25
|
+
runner.expects(:system).with *%w(testdrb test/test_minitest.rb)
|
26
|
+
runner.run(['test/test_minitest.rb'], :drb => true)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -1,78 +1,58 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
|
-
describe Guard::
|
5
|
-
subject { Guard::
|
4
|
+
describe Guard::SporkMinitest do
|
5
|
+
subject { Guard::SporkMinitest }
|
6
6
|
|
7
7
|
let(:runner) { stub('runner', :test_folders => [], :test_file_patterns => []) }
|
8
8
|
let(:inspector) { stub('inspector') }
|
9
9
|
let(:guard) { subject.new }
|
10
10
|
|
11
11
|
before(:each) do
|
12
|
-
Guard::
|
13
|
-
Guard::
|
12
|
+
Guard::SporkMinitest::Runner.stubs(:new).returns(runner)
|
13
|
+
Guard::SporkMinitest::Inspector.stubs(:new).returns(inspector)
|
14
14
|
end
|
15
15
|
|
16
16
|
after(:each) do
|
17
|
-
Guard::
|
18
|
-
Guard::
|
17
|
+
Guard::SporkMinitest::Runner.unstub(:new)
|
18
|
+
Guard::SporkMinitest::Inspector.unstub(:new)
|
19
19
|
end
|
20
20
|
|
21
21
|
describe 'initialization' do
|
22
|
-
|
23
22
|
it 'should initialize runner with options' do
|
24
|
-
Guard::
|
23
|
+
Guard::SporkMinitest::Runner.expects(:new).with({}).returns(runner)
|
25
24
|
subject.new
|
26
25
|
end
|
27
26
|
|
28
27
|
it 'should initialize inspector with options' do
|
29
|
-
Guard::
|
28
|
+
Guard::SporkMinitest::Inspector.expects(:new).with(runner.test_folders, runner.test_file_patterns).returns(inspector)
|
30
29
|
subject.new
|
31
30
|
end
|
32
|
-
|
33
31
|
end
|
34
32
|
|
35
33
|
describe 'start' do
|
36
|
-
|
37
|
-
it 'should return true' do
|
38
|
-
guard.start.must_equal true
|
39
|
-
end
|
40
|
-
|
34
|
+
it 'should return true' do guard.start.must_equal true end
|
41
35
|
end
|
42
|
-
|
43
36
|
describe 'stop' do
|
44
|
-
|
45
|
-
it 'should return true' do
|
46
|
-
guard.stop.must_equal true
|
47
|
-
end
|
48
|
-
|
37
|
+
it 'should return true' do guard.stop.must_equal true end
|
49
38
|
end
|
50
|
-
|
51
39
|
describe 'reload' do
|
52
|
-
|
53
|
-
it 'should return true' do
|
54
|
-
guard.reload.must_equal true
|
55
|
-
end
|
56
|
-
|
40
|
+
it 'should return true' do guard.reload.must_equal true end
|
57
41
|
end
|
58
42
|
|
59
43
|
describe 'run_all' do
|
60
|
-
|
61
44
|
it 'should run all tests' do
|
62
45
|
inspector.stubs(:clean_all).returns(['test/guard/minitest/test_inspector.rb', 'test/guard/test_minitest.rb'])
|
63
46
|
runner.expects(:run).with(['test/guard/minitest/test_inspector.rb', 'test/guard/test_minitest.rb'], {:message => 'Running all tests'}).returns(true)
|
64
47
|
guard.run_all.must_equal true
|
65
48
|
end
|
66
|
-
|
67
49
|
end
|
68
50
|
|
69
51
|
describe 'run_on_changes' do
|
70
|
-
|
71
52
|
it 'should run minitest in paths' do
|
72
53
|
inspector.stubs(:clean).with(['test/guard/minitest/test_inspector.rb']).returns(['test/guard/minitest/test_inspector.rb'])
|
73
54
|
runner.expects(:run).with(['test/guard/minitest/test_inspector.rb']).returns(true)
|
74
55
|
guard.run_on_changes(['test/guard/minitest/test_inspector.rb']).must_equal true
|
75
56
|
end
|
76
|
-
|
77
57
|
end
|
78
58
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-sporkminitest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2013-01-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: guard
|
@@ -183,10 +183,10 @@ files:
|
|
183
183
|
- lib/guard/sporkminitest/templates/Guardfile
|
184
184
|
- lib/guard/sporkminitest/version.rb
|
185
185
|
- spec/fixtures/bundler/Gemfile
|
186
|
-
- spec/guard/
|
187
|
-
- spec/guard/
|
188
|
-
- spec/guard/
|
189
|
-
- spec/guard/
|
186
|
+
- spec/guard/sporkminitest/inspector_spec.rb
|
187
|
+
- spec/guard/sporkminitest/notifier_spec.rb
|
188
|
+
- spec/guard/sporkminitest/runner_spec.rb
|
189
|
+
- spec/guard/sporkminitest_spec.rb
|
190
190
|
- spec/spec_helper.rb
|
191
191
|
- test/guard/minitest/test_inspector.rb
|
192
192
|
- test/guard/minitest_test.rb
|
@@ -222,10 +222,10 @@ test_files:
|
|
222
222
|
- .gemspec
|
223
223
|
- lib/guard/sporkminitest/inspector.rb
|
224
224
|
- spec/fixtures/bundler/Gemfile
|
225
|
-
- spec/guard/
|
226
|
-
- spec/guard/
|
227
|
-
- spec/guard/
|
228
|
-
- spec/guard/
|
225
|
+
- spec/guard/sporkminitest/inspector_spec.rb
|
226
|
+
- spec/guard/sporkminitest/notifier_spec.rb
|
227
|
+
- spec/guard/sporkminitest/runner_spec.rb
|
228
|
+
- spec/guard/sporkminitest_spec.rb
|
229
229
|
- spec/spec_helper.rb
|
230
230
|
- test/guard/minitest/test_inspector.rb
|
231
231
|
has_rdoc:
|
@@ -1,175 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
describe Guard::Minitest::Runner do
|
5
|
-
subject { Guard::Minitest::Runner }
|
6
|
-
|
7
|
-
describe 'options' do
|
8
|
-
|
9
|
-
describe 'cli_options' do
|
10
|
-
it 'default should be empty string' do
|
11
|
-
subject.new.cli_options.must_equal ''
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'should be set with \'cli\'' do
|
15
|
-
subject.new(:cli => '--test').cli_options.must_equal '--test'
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe 'deprecated options' do
|
20
|
-
describe 'seed' do
|
21
|
-
it 'should set cli options' do
|
22
|
-
Guard::UI.expects(:info).with('DEPRECATION WARNING: The :seed option is deprecated. Pass standard command line argument "--seed" to MiniTest with the :cli option.')
|
23
|
-
subject.new(:seed => 123456789).cli_options.must_match /--seed 123456789/
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
describe 'verbose' do
|
28
|
-
it 'should set cli options' do
|
29
|
-
Guard::UI.expects(:info).with('DEPRECATION WARNING: The :verbose option is deprecated. Pass standard command line argument "--verbose" to MiniTest with the :cli option.')
|
30
|
-
subject.new(:verbose => true).cli_options.must_match /--verbose/
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe 'bundler' do
|
36
|
-
it 'default should be true if Gemfile exist' do
|
37
|
-
Dir.stubs(:pwd).returns(fixtures_path.join('bundler'))
|
38
|
-
subject.new.bundler?.must_equal true
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'default should be false if Gemfile don\'t exist' do
|
42
|
-
Dir.stubs(:pwd).returns(fixtures_path.join('empty'))
|
43
|
-
subject.new.bundler?.must_equal false
|
44
|
-
end
|
45
|
-
|
46
|
-
it 'should be forced to false' do
|
47
|
-
Dir.stubs(:pwd).returns(fixtures_path.join('bundler'))
|
48
|
-
subject.new(:bundler => false).bundler?.must_equal false
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
describe 'rubygems' do
|
53
|
-
it 'default should be false if Gemfile exist' do
|
54
|
-
Dir.stubs(:pwd).returns(fixtures_path.join('bundler'))
|
55
|
-
subject.new.rubygems?.must_equal false
|
56
|
-
end
|
57
|
-
|
58
|
-
it 'default should be false if Gemfile don\'t exist' do
|
59
|
-
Dir.stubs(:pwd).returns(fixtures_path.join('empty'))
|
60
|
-
subject.new.rubygems?.must_equal false
|
61
|
-
end
|
62
|
-
|
63
|
-
it 'should be set to true if bundler is disabled' do
|
64
|
-
subject.new(:bundler => false, :rubygems => true).rubygems?.must_equal true
|
65
|
-
end
|
66
|
-
|
67
|
-
it 'should not be set to true if bundler is enabled' do
|
68
|
-
subject.new(:bundler => true, :rubygems => true).rubygems?.must_equal false
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
describe 'drb' do
|
73
|
-
it 'default should be false' do
|
74
|
-
subject.new.drb?.must_equal false
|
75
|
-
end
|
76
|
-
|
77
|
-
it 'should be set' do
|
78
|
-
subject.new(:drb => true).drb?.must_equal true
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
describe 'run' do
|
84
|
-
before(:each) do
|
85
|
-
Dir.stubs(:pwd).returns(fixtures_path.join('empty'))
|
86
|
-
@default_runner = File.expand_path('../../../../lib/guard/minitest/runners/default_runner.rb', __FILE__)
|
87
|
-
end
|
88
|
-
|
89
|
-
it 'should run with specified seed' do
|
90
|
-
runner = subject.new(:test_folders => %w[test], :cli => '--seed 12345')
|
91
|
-
runner.expects(:system).with(
|
92
|
-
"ruby -I\"test\" -r ./test/test_minitest.rb -r #{@default_runner} -e 'MiniTest::Unit.autorun' -- --seed 12345"
|
93
|
-
)
|
94
|
-
runner.run(['test/test_minitest.rb'])
|
95
|
-
end
|
96
|
-
|
97
|
-
it 'should run in verbose mode' do
|
98
|
-
runner = subject.new(:test_folders => %w[test], :cli => '--verbose')
|
99
|
-
runner.expects(:system).with(
|
100
|
-
"ruby -I\"test\" -r ./test/test_minitest.rb -r #{@default_runner} -e 'MiniTest::Unit.autorun' -- --verbose"
|
101
|
-
)
|
102
|
-
runner.run(['test/test_minitest.rb'])
|
103
|
-
end
|
104
|
-
|
105
|
-
describe 'in empty folder' do
|
106
|
-
|
107
|
-
before(:each) do
|
108
|
-
Dir.stubs(:pwd).returns(fixtures_path.join('empty'))
|
109
|
-
end
|
110
|
-
|
111
|
-
it 'should run without bundler and rubygems' do
|
112
|
-
runner = subject.new(:test_folders => %w[test])
|
113
|
-
Guard::UI.expects(:info)
|
114
|
-
runner.expects(:system).with(
|
115
|
-
"ruby -I\"test\" -r ./test/test_minitest.rb -r #{@default_runner} -e 'MiniTest::Unit.autorun'"
|
116
|
-
)
|
117
|
-
runner.run(['test/test_minitest.rb'])
|
118
|
-
end
|
119
|
-
|
120
|
-
it 'should run without bundler but rubygems' do
|
121
|
-
runner = subject.new(:test_folders => %w[test], :rubygems => true)
|
122
|
-
Guard::UI.expects(:info)
|
123
|
-
runner.expects(:system).with(
|
124
|
-
"ruby -I\"test\" -r rubygems -r ./test/test_minitest.rb -r #{@default_runner} -e 'MiniTest::Unit.autorun'"
|
125
|
-
)
|
126
|
-
runner.run(['test/test_minitest.rb'])
|
127
|
-
end
|
128
|
-
|
129
|
-
end
|
130
|
-
|
131
|
-
describe 'in bundler folder' do
|
132
|
-
before(:each) do
|
133
|
-
Dir.stubs(:pwd).returns(fixtures_path.join('bundler'))
|
134
|
-
end
|
135
|
-
|
136
|
-
it 'should run with bundler but not rubygems' do
|
137
|
-
runner = subject.new(:test_folders => %w[test], :bundler => true, :rubygems => false)
|
138
|
-
Guard::UI.expects(:info)
|
139
|
-
runner.expects(:system).with(
|
140
|
-
"bundle exec ruby -I\"test\" -r bundler/setup -r ./test/test_minitest.rb -r #{@default_runner} -e 'MiniTest::Unit.autorun'"
|
141
|
-
)
|
142
|
-
runner.run(['test/test_minitest.rb'])
|
143
|
-
end
|
144
|
-
|
145
|
-
it 'should run without bundler but rubygems' do
|
146
|
-
runner = subject.new(:test_folders => %w[test], :bundler => false, :rubygems => true)
|
147
|
-
Guard::UI.expects(:info)
|
148
|
-
runner.expects(:system).with(
|
149
|
-
"ruby -I\"test\" -r rubygems -r ./test/test_minitest.rb -r #{@default_runner} -e 'MiniTest::Unit.autorun'"
|
150
|
-
)
|
151
|
-
runner.run(['test/test_minitest.rb'], :bundler => false, :rubygems => true)
|
152
|
-
end
|
153
|
-
|
154
|
-
it 'should run without bundler and rubygems' do
|
155
|
-
runner = subject.new(:test_folders => %w[test], :bundler => false, :rubygems => false)
|
156
|
-
Guard::UI.expects(:info)
|
157
|
-
runner.expects(:system).with(
|
158
|
-
"ruby -I\"test\" -r ./test/test_minitest.rb -r #{@default_runner} -e 'MiniTest::Unit.autorun'"
|
159
|
-
)
|
160
|
-
runner.run(['test/test_minitest.rb'], :bundler => false, :rubygems => false)
|
161
|
-
end
|
162
|
-
|
163
|
-
end
|
164
|
-
|
165
|
-
describe 'drb' do
|
166
|
-
it 'should run with drb' do
|
167
|
-
runner = subject.new(:test_folders => %w[test], :drb => true)
|
168
|
-
Guard::UI.expects(:info)
|
169
|
-
runner.expects(:system).with('testdrb ./test/test_minitest.rb')
|
170
|
-
runner.run(['test/test_minitest.rb'], :drb => true)
|
171
|
-
end
|
172
|
-
|
173
|
-
end
|
174
|
-
end
|
175
|
-
end
|