minitest-sound 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/minitest/sound/reporter.rb +6 -2
- data/lib/minitest/sound/version.rb +1 -1
- data/minitest-sound.gemspec +1 -2
- metadata +3 -17
- data/.gitignore +0 -17
- data/Gemfile +0 -4
- data/Rakefile +0 -8
- data/test/fixtures/during_test.mp3 +0 -0
- data/test/fixtures/failure.mp3 +0 -0
- data/test/fixtures/success.mp3 +0 -0
- data/test/player_test.rb +0 -60
- data/test/test_helper.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9117041ce681a354ee81040cfa8ff9e58dfd1e4
|
4
|
+
data.tar.gz: b3197e6f6630d57c2fac58e21b21659d18b910d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8e969fe2936f89620e51833e85a4200bdb250a84c3a313e2785c2206231962e160cd63216d3573037d7b8f23092120d7abfd53930b7bdea80b854be2fecd962
|
7
|
+
data.tar.gz: eaf46a9db0e563dc27acf61770224f96d8c81bd8ac797e04548e2f6f93d02c252c88d86c677f6eac9619ac5630fddf86890064035bfe42287650bf962cac7415
|
@@ -19,11 +19,15 @@ module Minitest
|
|
19
19
|
def report
|
20
20
|
super
|
21
21
|
@player.stop_during_test_sound
|
22
|
-
|
22
|
+
test_success? ? @player.play_success_sound : @player.play_failure_sound
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_success?
|
26
|
+
errors == 0 && failures == 0
|
23
27
|
end
|
24
28
|
|
25
29
|
|
26
|
-
# When using the following methods together with
|
30
|
+
# When using the following methods together with `minitest-reporters`, they are required.
|
27
31
|
def add_defaults(defaults); end
|
28
32
|
|
29
33
|
def before_test(test); end
|
data/minitest-sound.gemspec
CHANGED
@@ -12,9 +12,8 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.homepage = "https://github.com/y-yagi/minitest-sound"
|
13
13
|
spec.license = "MIT"
|
14
14
|
|
15
|
-
spec.files =
|
15
|
+
spec.files = %w(LICENSE.txt README.md minitest-sound.gemspec) + Dir['lib/**/*.rb']
|
16
16
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
17
|
spec.require_paths = ["lib"]
|
19
18
|
|
20
19
|
spec.add_dependency 'minitest', '>= 5.0'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-sound
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuji Yaginuma
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -73,22 +73,14 @@ executables: []
|
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
-
- ".gitignore"
|
77
|
-
- Gemfile
|
78
76
|
- LICENSE.txt
|
79
77
|
- README.md
|
80
|
-
- Rakefile
|
81
78
|
- lib/minitest/sound.rb
|
82
79
|
- lib/minitest/sound/player.rb
|
83
80
|
- lib/minitest/sound/reporter.rb
|
84
81
|
- lib/minitest/sound/version.rb
|
85
82
|
- lib/minitest/sound_plugin.rb
|
86
83
|
- minitest-sound.gemspec
|
87
|
-
- test/fixtures/during_test.mp3
|
88
|
-
- test/fixtures/failure.mp3
|
89
|
-
- test/fixtures/success.mp3
|
90
|
-
- test/player_test.rb
|
91
|
-
- test/test_helper.rb
|
92
84
|
homepage: https://github.com/y-yagi/minitest-sound
|
93
85
|
licenses:
|
94
86
|
- MIT
|
@@ -113,10 +105,4 @@ rubygems_version: 2.2.2
|
|
113
105
|
signing_key:
|
114
106
|
specification_version: 4
|
115
107
|
summary: Play a sound when test finished
|
116
|
-
test_files:
|
117
|
-
- test/fixtures/during_test.mp3
|
118
|
-
- test/fixtures/failure.mp3
|
119
|
-
- test/fixtures/success.mp3
|
120
|
-
- test/player_test.rb
|
121
|
-
- test/test_helper.rb
|
122
|
-
has_rdoc:
|
108
|
+
test_files: []
|
data/.gitignore
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
Binary file
|
data/test/fixtures/failure.mp3
DELETED
Binary file
|
data/test/fixtures/success.mp3
DELETED
Binary file
|
data/test/player_test.rb
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
require_relative 'test_helper'
|
2
|
-
require 'sys/proctable'
|
3
|
-
include Sys
|
4
|
-
|
5
|
-
module MinitestSoundTest
|
6
|
-
class PlayerTest < MiniTest::Test
|
7
|
-
def setup
|
8
|
-
@fixtures_directory = File.expand_path('../fixtures', __FILE__)
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_do_nothing_when_unset_success
|
12
|
-
player = Minitest::Sound::Player.new
|
13
|
-
player.play_success_sound
|
14
|
-
assert_equal(false, play_sound?)
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_play_success_sound_when_set_success
|
18
|
-
success_sound = File.join(@fixtures_directory, 'success.mp3')
|
19
|
-
player = Minitest::Sound::Player.new(success: success_sound)
|
20
|
-
pid = player.play_success_sound(false)
|
21
|
-
assert_equal(true, play_sound?(success_sound))
|
22
|
-
Process.kill('SIGINT', pid)
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_do_nothing_when_unset_failure
|
26
|
-
player = Minitest::Sound::Player.new
|
27
|
-
player.play_failure_sound
|
28
|
-
assert_equal(false, play_sound?)
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_play_failure_sound_when_set_faiure
|
32
|
-
failure_sound = File.join(@fixtures_directory, 'failure.mp3')
|
33
|
-
player = Minitest::Sound::Player.new(failure: failure_sound)
|
34
|
-
pid = player.play_failure_sound(false)
|
35
|
-
assert_equal(true, play_sound?(failure_sound))
|
36
|
-
Process.kill('SIGINT', pid)
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_output_errmsg_when_donot_install_mpg123
|
40
|
-
original_path = ENV['PATH']
|
41
|
-
ENV['PATH'] = ''
|
42
|
-
|
43
|
-
success_sound = File.join(@fixtures_directory, 'success.mp3')
|
44
|
-
player = Minitest::Sound::Player.new(success: success_sound)
|
45
|
-
|
46
|
-
out, err = capture_io { player.play_success_sound }
|
47
|
-
assert_equal(%Q(warning: minitest-sound use "mpg123". Please install "mpg123".\n), err)
|
48
|
-
ensure
|
49
|
-
ENV['PATH'] = original_path
|
50
|
-
end
|
51
|
-
|
52
|
-
private
|
53
|
-
def play_sound?(file = nil)
|
54
|
-
processes = ProcTable.ps.select{|s| s.comm == 'mpg123'}
|
55
|
-
return false if processes.empty?
|
56
|
-
|
57
|
-
processes.any?{|p| p.cmdline == "mpg123 #{file}"}
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|