musical_spec 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/{Changelog.md → NEWS.md} +4 -0
- data/README.md +5 -3
- data/Rakefile +1 -2
- data/lib/musical_spec/formatter.rb +17 -19
- data/lib/musical_spec/note.rb +28 -26
- data/lib/musical_spec/player.rb +2 -2
- data/lib/musical_spec/version.rb +1 -1
- data/musical_spec.gemspec +3 -4
- data/spec/musical_spec/formatter_spec.rb +36 -10
- data/spec/musical_spec/note_spec.rb +28 -28
- data/spec/musical_spec/player_spec.rb +42 -22
- data/spec/musical_spec_spec.rb +3 -3
- data/spec/spec_helper.rb +4 -3
- metadata +31 -37
- data/lib/musical_spec/bloops.rb +0 -36
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a575ba2688860d3bc63cc531189e182f03232c10
|
4
|
+
data.tar.gz: 5e79b0c2477e34e4e9ef275e84322cc2649b9b31
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: fd1d50386d1a78e1ee0ad789f6582f21c8378eab2cf94f309e3e741becc7d2ebb4a84fe541a36f0461ae3c8e77bf145bb337e7303232832c7b316225adb7a72b
|
7
|
+
data.tar.gz: 54e6e51ac8a6a0a3ca38447d91f0984e2589ca1156ce9acf43d863e404388efc8d210b5bb2fc8d9472f4adca2f2e988e82a5a49af38ecda56813aecc76a98bfe
|
data/{Changelog.md → NEWS.md}
RENAMED
data/README.md
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
# musical_spec
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
formatter
|
3
|
+
"A revelatory auditory experience!" - _Anonymous_
|
4
|
+
|
5
|
+
An RSpec 3 formatter that plays higher notes as tests pass and lower notes as
|
6
|
+
tests fail. It's a subclass of the progress formatter, so you still get your
|
7
|
+
pretty dots.
|
6
8
|
|
7
9
|
## Usage
|
8
10
|
|
data/Rakefile
CHANGED
@@ -4,51 +4,49 @@ require 'rspec/core/formatters/progress_formatter'
|
|
4
4
|
|
5
5
|
module MusicalSpec
|
6
6
|
class Formatter < RSpec::Core::Formatters::ProgressFormatter
|
7
|
-
|
7
|
+
RSpec::Core::Formatters.register self, :example_passed, :example_failed,
|
8
|
+
:example_pending
|
9
|
+
|
10
|
+
def initialize(output, note = nil)
|
8
11
|
super(output)
|
9
|
-
@note
|
12
|
+
@note = Note.new(note)
|
10
13
|
@player = Player.new
|
11
14
|
end
|
12
15
|
|
13
16
|
attr_reader :player
|
14
17
|
|
15
|
-
# Plays a higher note
|
16
|
-
def example_passed(
|
18
|
+
# Plays a higher note then print a progress dot
|
19
|
+
def example_passed(notification)
|
17
20
|
play_higher_note
|
18
|
-
super
|
21
|
+
super
|
19
22
|
end
|
20
23
|
|
21
|
-
# Plays a lower note
|
22
|
-
def example_failed(
|
24
|
+
# Plays a lower note then print a progress dot
|
25
|
+
def example_failed(notification)
|
23
26
|
play_lower_note
|
24
|
-
super
|
27
|
+
super
|
25
28
|
end
|
26
29
|
|
27
|
-
# Plays a note without changing the pitch
|
28
|
-
def example_pending(
|
30
|
+
# Plays a note without changing the pitch then print a progress dot
|
31
|
+
def example_pending(notification)
|
29
32
|
play_note
|
30
|
-
super
|
33
|
+
super
|
31
34
|
end
|
32
35
|
|
33
36
|
private
|
34
37
|
|
35
38
|
def play_note
|
36
|
-
@player.play(note)
|
39
|
+
@player.play(@note)
|
37
40
|
end
|
38
41
|
|
39
42
|
def play_higher_note
|
40
|
-
@note.
|
43
|
+
@note.higher!
|
41
44
|
play_note
|
42
45
|
end
|
43
46
|
|
44
47
|
def play_lower_note
|
45
|
-
@note.
|
48
|
+
@note.lower!
|
46
49
|
play_note
|
47
50
|
end
|
48
|
-
|
49
|
-
|
50
|
-
def note
|
51
|
-
@note.note
|
52
|
-
end
|
53
51
|
end
|
54
52
|
end
|
data/lib/musical_spec/note.rb
CHANGED
@@ -7,15 +7,9 @@ module MusicalSpec
|
|
7
7
|
|
8
8
|
# Takes 1 optional argument, a note string like "C4".
|
9
9
|
def initialize(desired_note_string = nil)
|
10
|
-
|
11
|
-
self.note = LOWEST_NOTE.to_s
|
12
|
-
else
|
13
|
-
self.note = desired_note_string
|
14
|
-
end
|
10
|
+
self.note = desired_note_string || LOWEST_NOTE.to_s
|
15
11
|
end
|
16
12
|
|
17
|
-
attr_reader :letter, :octave
|
18
|
-
|
19
13
|
# A string like "C4".
|
20
14
|
def to_s
|
21
15
|
"#{letter}#{octave}"
|
@@ -32,42 +26,50 @@ module MusicalSpec
|
|
32
26
|
|
33
27
|
# Increase the pitch, handling octave changes. Will not go above
|
34
28
|
# MusicalSpec::HIGHEST_NOTE.
|
35
|
-
def
|
36
|
-
if
|
37
|
-
if @letter ==
|
38
|
-
@letter =
|
29
|
+
def higher!
|
30
|
+
if below_highest_note?
|
31
|
+
if @letter == SCALE_PROGRESSION.last
|
32
|
+
@letter = SCALE_PROGRESSION.first
|
39
33
|
@octave += 1
|
40
|
-
elsif @letter == 'G'
|
41
|
-
@letter = 'A'
|
42
34
|
else
|
43
|
-
@letter.
|
35
|
+
@letter = SCALE_PROGRESSION[SCALE_PROGRESSION.index(@letter) + 1]
|
44
36
|
end
|
45
37
|
end
|
46
38
|
end
|
47
39
|
|
48
40
|
# Decrease the pitch, handling octave changes. Will not go below
|
49
41
|
# MusicalSpec::LOWEST_NOTE.
|
50
|
-
def
|
51
|
-
if
|
52
|
-
if @letter ==
|
53
|
-
@letter =
|
42
|
+
def lower!
|
43
|
+
if above_lowest_note?
|
44
|
+
if @letter == SCALE_PROGRESSION.first
|
45
|
+
@letter = SCALE_PROGRESSION.last
|
54
46
|
@octave -= 1
|
55
|
-
elsif @letter == 'A'
|
56
|
-
@letter = 'G'
|
57
47
|
else
|
58
|
-
@letter = (@letter
|
48
|
+
@letter = SCALE_PROGRESSION[SCALE_PROGRESSION.index(@letter) - 1]
|
59
49
|
end
|
60
50
|
end
|
61
51
|
end
|
62
52
|
|
53
|
+
protected
|
54
|
+
|
55
|
+
attr_reader :letter, :octave
|
56
|
+
|
63
57
|
def <=>(other_note)
|
64
|
-
|
65
|
-
|
66
|
-
if octave == other_octave
|
67
|
-
SCALE_PROGRESSION.index(letter) <=> SCALE_PROGRESSION.index(other_letter)
|
58
|
+
if octave == other_note.octave
|
59
|
+
SCALE_PROGRESSION.index(letter) <=> SCALE_PROGRESSION.index(other_note.letter)
|
68
60
|
else
|
69
|
-
octave <=>
|
61
|
+
octave <=> other_note.octave
|
70
62
|
end
|
71
63
|
end
|
64
|
+
|
65
|
+
private
|
66
|
+
|
67
|
+
def below_highest_note?
|
68
|
+
self < HIGHEST_NOTE
|
69
|
+
end
|
70
|
+
|
71
|
+
def above_lowest_note?
|
72
|
+
self > LOWEST_NOTE
|
73
|
+
end
|
72
74
|
end
|
73
75
|
end
|
data/lib/musical_spec/player.rb
CHANGED
@@ -7,10 +7,10 @@ module MusicalSpec
|
|
7
7
|
ONE_TRUE_BLOOPSAPHONE.tempo = 320
|
8
8
|
end
|
9
9
|
|
10
|
-
# Takes a
|
10
|
+
# Takes a Note instance.
|
11
11
|
def play(note)
|
12
12
|
ONE_TRUE_BLOOPSAPHONE.clear
|
13
|
-
ONE_TRUE_BLOOPSAPHONE.tune(@sound, note)
|
13
|
+
ONE_TRUE_BLOOPSAPHONE.tune(@sound, note.to_s)
|
14
14
|
ONE_TRUE_BLOOPSAPHONE.play
|
15
15
|
sleep 0.01 while ! ONE_TRUE_BLOOPSAPHONE.stopped?
|
16
16
|
end
|
data/lib/musical_spec/version.rb
CHANGED
data/musical_spec.gemspec
CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |gem|
|
|
6
6
|
gem.email = ["gabe@thoughtbot.com"]
|
7
7
|
gem.description = %q{A musical formatter for RSpec.}
|
8
8
|
gem.summary = %q{A musical formatter for RSpec. The sound gets lower as failures pile up, and higher when tests pass.}
|
9
|
-
gem.homepage = ""
|
9
|
+
gem.homepage = "https://github.com/gabebw/musical_spec"
|
10
10
|
|
11
11
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
12
12
|
gem.files = `git ls-files`.split("\n")
|
@@ -16,8 +16,7 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.version = MusicalSpec::VERSION
|
17
17
|
|
18
18
|
gem.add_dependency('bloopsaphone', '~> 0.4')
|
19
|
-
gem.add_dependency('rspec-core', '~>
|
19
|
+
gem.add_dependency('rspec-core', '~> 3.0')
|
20
20
|
|
21
|
-
gem.add_development_dependency('rspec', '~>
|
22
|
-
gem.add_development_dependency('bourne', '~> 1.0')
|
21
|
+
gem.add_development_dependency('rspec', '~> 3.0')
|
23
22
|
end
|
@@ -2,25 +2,51 @@ require 'spec_helper'
|
|
2
2
|
require 'stringio'
|
3
3
|
|
4
4
|
describe MusicalSpec::Formatter do
|
5
|
-
|
5
|
+
it 'is a ProgressFormatter' do
|
6
|
+
formatter = MusicalSpec::Formatter.new('C4')
|
7
|
+
expect(formatter).to be_a RSpec::Core::Formatters::ProgressFormatter
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'tells RSpec that it can handle passed/failed/pending specs' do
|
11
|
+
registered_formatters = RSpec::Core::Formatters::Loader.formatters
|
6
12
|
|
7
|
-
|
13
|
+
expect(registered_formatters[MusicalSpec::Formatter]).to eq [
|
14
|
+
:example_passed,
|
15
|
+
:example_failed,
|
16
|
+
:example_pending
|
17
|
+
]
|
18
|
+
end
|
8
19
|
|
9
20
|
it 'plays a higher-pitched sound when an example passes' do
|
10
|
-
|
11
|
-
|
21
|
+
formatter = formatter_with_note('E4')
|
22
|
+
formatter.example_passed(example)
|
23
|
+
expect(formatter.player).to have_played('F4').once
|
12
24
|
end
|
13
25
|
|
14
26
|
it 'plays a lower-pitched sound when an example fails' do
|
15
|
-
|
16
|
-
|
27
|
+
formatter = formatter_with_note('E4')
|
28
|
+
formatter.example_failed(example)
|
29
|
+
expect(formatter.player).to have_played('D4').once
|
17
30
|
end
|
18
31
|
|
19
32
|
it 'does not change the note when an example is pending' do
|
20
|
-
|
21
|
-
|
33
|
+
formatter = formatter_with_note('E4')
|
34
|
+
formatter.example_pending(example)
|
35
|
+
expect(formatter.player).to have_played('E4').once
|
36
|
+
end
|
37
|
+
|
38
|
+
def formatter_with_note(note)
|
39
|
+
MusicalSpec::Formatter.new(StringIO.new, note).tap do |formatter|
|
40
|
+
allow(formatter.player).to receive(:play)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def have_played(note_string)
|
45
|
+
note = MusicalSpec::Note.new(note_string)
|
46
|
+
have_received(:play).with(note)
|
22
47
|
end
|
23
48
|
|
24
|
-
|
25
|
-
|
49
|
+
def example
|
50
|
+
RSpec::Core::ExampleGroup.describe.example
|
51
|
+
end
|
26
52
|
end
|
@@ -2,97 +2,97 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe MusicalSpec::Note do
|
4
4
|
it 'defaults to the lowest note' do
|
5
|
-
subject.to_s.
|
5
|
+
expect(subject.to_s).to eq(MusicalSpec::LOWEST_NOTE.to_s)
|
6
6
|
end
|
7
7
|
|
8
8
|
it 'can be initialized with a note' do
|
9
|
-
MusicalSpec::Note.new('E4').to_s.
|
9
|
+
expect(MusicalSpec::Note.new('E4').to_s).to eq('E4')
|
10
10
|
end
|
11
11
|
|
12
12
|
it 'does not go higher than B6' do
|
13
13
|
subject.note = 'B6'
|
14
|
-
subject.
|
15
|
-
subject.to_s.
|
14
|
+
subject.higher!
|
15
|
+
expect(subject.to_s).to eq('B6')
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'does not go lower than C2' do
|
19
19
|
subject.note = 'C2'
|
20
|
-
subject.
|
21
|
-
subject.to_s.
|
20
|
+
subject.lower!
|
21
|
+
expect(subject.to_s).to eq('C2')
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'allows setting the note' do
|
25
25
|
subject.note = 'A4'
|
26
|
-
subject.to_s.
|
26
|
+
expect(subject.to_s).to eq('A4')
|
27
27
|
end
|
28
28
|
|
29
|
-
context '#
|
29
|
+
context '#higher!' do
|
30
30
|
it 'increases the note by 1' do
|
31
31
|
subject.note = 'C4'
|
32
|
-
subject.
|
33
|
-
subject.to_s.
|
32
|
+
subject.higher!
|
33
|
+
expect(subject.to_s).to eq('D4')
|
34
34
|
end
|
35
35
|
|
36
36
|
it 'changes octaves when moving from B to C' do
|
37
37
|
subject.note = 'B4'
|
38
|
-
subject.
|
39
|
-
subject.to_s.
|
38
|
+
subject.higher!
|
39
|
+
expect(subject.to_s).to eq('C5')
|
40
40
|
end
|
41
41
|
|
42
42
|
it 'does not change octaves when moving from G to A' do
|
43
43
|
subject.note = 'G4'
|
44
|
-
subject.
|
45
|
-
subject.to_s.
|
44
|
+
subject.higher!
|
45
|
+
expect(subject.to_s).to eq('A4')
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
context '#
|
49
|
+
context '#lower!' do
|
50
50
|
it 'decreases the note by 1' do
|
51
51
|
subject.note = 'E4'
|
52
|
-
subject.
|
53
|
-
subject.to_s.
|
52
|
+
subject.lower!
|
53
|
+
expect(subject.to_s).to eq('D4')
|
54
54
|
end
|
55
55
|
|
56
56
|
it 'changes octaves when moving from C to B' do
|
57
57
|
subject.note = 'C4'
|
58
|
-
subject.
|
59
|
-
subject.to_s.
|
58
|
+
subject.lower!
|
59
|
+
expect(subject.to_s).to eq('B3')
|
60
60
|
end
|
61
61
|
|
62
62
|
it 'does not change octaves when moving from A to G' do
|
63
63
|
subject.note = 'A4'
|
64
|
-
subject.
|
65
|
-
subject.to_s.
|
64
|
+
subject.lower!
|
65
|
+
expect(subject.to_s).to eq('G4')
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
69
|
context '<=>' do
|
70
70
|
it 'knows that D4 < E4' do
|
71
|
-
d4.
|
71
|
+
expect(d4).to be < e4
|
72
72
|
end
|
73
73
|
|
74
74
|
it 'knows that E4 > D4' do
|
75
|
-
e4.
|
75
|
+
expect(e4).to be > d4
|
76
76
|
end
|
77
77
|
|
78
78
|
it 'knows that C4 > B3' do
|
79
|
-
c4.
|
79
|
+
expect(c4).to be > b3
|
80
80
|
end
|
81
81
|
|
82
82
|
it 'knows that B3 < C4' do
|
83
|
-
b3.
|
83
|
+
expect(b3).to be < c4
|
84
84
|
end
|
85
85
|
|
86
86
|
it 'knows that A4 > G4' do
|
87
|
-
a4.
|
87
|
+
expect(a4).to be > g4
|
88
88
|
end
|
89
89
|
|
90
90
|
it 'knows that A4 == A4' do
|
91
|
-
a4.
|
91
|
+
expect(a4).to eq(a4)
|
92
92
|
end
|
93
93
|
|
94
94
|
it 'knows that G4 < A4' do
|
95
|
-
g4.
|
95
|
+
expect(g4).to be < a4
|
96
96
|
end
|
97
97
|
|
98
98
|
let(:d4) { MusicalSpec::Note.new('D4') }
|
@@ -1,36 +1,56 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe MusicalSpec::Player do
|
4
|
-
before do
|
5
|
-
@real_bloopsaphone = MusicalSpec::ONE_TRUE_BLOOPSAPHONE
|
6
|
-
MusicalSpec::ONE_TRUE_BLOOPSAPHONE = fake_bloopsaphone
|
7
|
-
end
|
8
|
-
|
9
|
-
after { MusicalSpec::ONE_TRUE_BLOOPSAPHONE = @real_bloopsaphone }
|
10
|
-
|
11
4
|
it 'sets the correct note' do
|
12
|
-
|
13
|
-
|
5
|
+
bloopsaphone_mock = build_bloopsaphone_mock
|
6
|
+
sound = bloopsaphone_mock.sound
|
7
|
+
with_one_true_bloopsaphone(bloopsaphone_mock) do
|
8
|
+
subject.play(MusicalSpec::Note.new('C4'))
|
9
|
+
expect(bloopsaphone_mock).to have_received(:tune).with(sound, 'C4')
|
10
|
+
end
|
14
11
|
end
|
15
12
|
|
16
13
|
it 'clears tunes before playing' do
|
17
|
-
|
18
|
-
|
14
|
+
bloopsaphone_mock = build_bloopsaphone_mock
|
15
|
+
with_one_true_bloopsaphone(bloopsaphone_mock) do
|
16
|
+
subject.play(MusicalSpec::Note.new('C4'))
|
17
|
+
expect(bloopsaphone_mock).to have_received(:clear).once
|
18
|
+
end
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'plays the tune' do
|
22
|
-
|
23
|
-
|
22
|
+
bloopsaphone_mock = build_bloopsaphone_mock
|
23
|
+
with_one_true_bloopsaphone(bloopsaphone_mock) do
|
24
|
+
subject.play(MusicalSpec::Note.new('C4'))
|
25
|
+
expect(bloopsaphone_mock).to have_received(:play).once
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def fake_sound
|
30
|
+
double("Bloopsaphone sound", "sustain=" => nil)
|
31
|
+
end
|
32
|
+
|
33
|
+
def build_bloopsaphone_mock
|
34
|
+
double(
|
35
|
+
'Fake Bloopsaphone',
|
36
|
+
:tune => nil,
|
37
|
+
:tempo= => nil,
|
38
|
+
:play => nil,
|
39
|
+
:clear => nil,
|
40
|
+
:stopped? => true,
|
41
|
+
:sound => fake_sound,
|
42
|
+
)
|
24
43
|
end
|
25
44
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
45
|
+
def with_one_true_bloopsaphone(new_bloopsaphone)
|
46
|
+
real_bloopsaphone = MusicalSpec::ONE_TRUE_BLOOPSAPHONE
|
47
|
+
MusicalSpec.send(:remove_const, :ONE_TRUE_BLOOPSAPHONE)
|
48
|
+
MusicalSpec.const_set(:ONE_TRUE_BLOOPSAPHONE, new_bloopsaphone)
|
49
|
+
begin
|
50
|
+
yield
|
51
|
+
ensure
|
52
|
+
MusicalSpec.send(:remove_const, :ONE_TRUE_BLOOPSAPHONE)
|
53
|
+
MusicalSpec.const_set(:ONE_TRUE_BLOOPSAPHONE, real_bloopsaphone)
|
54
|
+
end
|
35
55
|
end
|
36
56
|
end
|
data/spec/musical_spec_spec.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe MusicalSpec do
|
4
|
-
it "
|
5
|
-
MusicalSpec::ONE_TRUE_BLOOPSAPHONE.
|
3
|
+
describe MusicalSpec::ONE_TRUE_BLOOPSAPHONE do
|
4
|
+
it "is a Bloopsaphone singleton because of thread wackiness" do
|
5
|
+
expect(MusicalSpec::ONE_TRUE_BLOOPSAPHONE).to be_a Bloops
|
6
6
|
end
|
7
7
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
$LOAD_PATH << File.expand_path('../lib', __FILE__)
|
2
2
|
|
3
3
|
require 'rspec'
|
4
|
-
require 'bourne'
|
5
|
-
|
6
4
|
require 'musical_spec'
|
7
5
|
|
8
6
|
RSpec.configure do |config|
|
9
|
-
config.mock_with :
|
7
|
+
config.mock_with :rspec
|
8
|
+
config.expect_with :rspec do |c|
|
9
|
+
c.syntax = :expect
|
10
|
+
end
|
10
11
|
end
|
metadata
CHANGED
@@ -1,60 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: musical_spec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Gabe Berke-Williams
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2015-10-23 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: bloopsaphone
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
|
-
- - ~>
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0.4'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.4'
|
25
27
|
- !ruby/object:Gem::Dependency
|
26
28
|
name: rspec-core
|
27
|
-
requirement:
|
28
|
-
none: false
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
|
-
- - ~>
|
31
|
+
- - "~>"
|
31
32
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
33
|
+
version: '3.0'
|
33
34
|
type: :runtime
|
34
35
|
prerelease: false
|
35
|
-
version_requirements:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.0'
|
36
41
|
- !ruby/object:Gem::Dependency
|
37
42
|
name: rspec
|
38
|
-
requirement:
|
39
|
-
none: false
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
40
44
|
requirements:
|
41
|
-
- - ~>
|
45
|
+
- - "~>"
|
42
46
|
- !ruby/object:Gem::Version
|
43
|
-
version: '
|
47
|
+
version: '3.0'
|
44
48
|
type: :development
|
45
49
|
prerelease: false
|
46
|
-
version_requirements:
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: bourne
|
49
|
-
requirement: &2153572800 !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
55
|
-
type: :development
|
56
|
-
prerelease: false
|
57
|
-
version_requirements: *2153572800
|
54
|
+
version: '3.0'
|
58
55
|
description: A musical formatter for RSpec.
|
59
56
|
email:
|
60
57
|
- gabe@thoughtbot.com
|
@@ -62,13 +59,12 @@ executables: []
|
|
62
59
|
extensions: []
|
63
60
|
extra_rdoc_files: []
|
64
61
|
files:
|
65
|
-
- .gitignore
|
66
|
-
- Changelog.md
|
62
|
+
- ".gitignore"
|
67
63
|
- Gemfile
|
64
|
+
- NEWS.md
|
68
65
|
- README.md
|
69
66
|
- Rakefile
|
70
67
|
- lib/musical_spec.rb
|
71
|
-
- lib/musical_spec/bloops.rb
|
72
68
|
- lib/musical_spec/formatter.rb
|
73
69
|
- lib/musical_spec/note.rb
|
74
70
|
- lib/musical_spec/player.rb
|
@@ -79,29 +75,28 @@ files:
|
|
79
75
|
- spec/musical_spec/player_spec.rb
|
80
76
|
- spec/musical_spec_spec.rb
|
81
77
|
- spec/spec_helper.rb
|
82
|
-
homepage:
|
78
|
+
homepage: https://github.com/gabebw/musical_spec
|
83
79
|
licenses: []
|
80
|
+
metadata: {}
|
84
81
|
post_install_message:
|
85
82
|
rdoc_options: []
|
86
83
|
require_paths:
|
87
84
|
- lib
|
88
85
|
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
86
|
requirements:
|
91
|
-
- -
|
87
|
+
- - ">="
|
92
88
|
- !ruby/object:Gem::Version
|
93
89
|
version: '0'
|
94
90
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
-
none: false
|
96
91
|
requirements:
|
97
|
-
- -
|
92
|
+
- - ">="
|
98
93
|
- !ruby/object:Gem::Version
|
99
94
|
version: '0'
|
100
95
|
requirements: []
|
101
96
|
rubyforge_project:
|
102
|
-
rubygems_version:
|
97
|
+
rubygems_version: 2.4.5.1
|
103
98
|
signing_key:
|
104
|
-
specification_version:
|
99
|
+
specification_version: 4
|
105
100
|
summary: A musical formatter for RSpec. The sound gets lower as failures pile up,
|
106
101
|
and higher when tests pass.
|
107
102
|
test_files:
|
@@ -110,4 +105,3 @@ test_files:
|
|
110
105
|
- spec/musical_spec/player_spec.rb
|
111
106
|
- spec/musical_spec_spec.rb
|
112
107
|
- spec/spec_helper.rb
|
113
|
-
has_rdoc:
|
data/lib/musical_spec/bloops.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
class SoundPlayer
|
3
|
-
def initialize
|
4
|
-
@bloopsaphone = Bloops.new
|
5
|
-
@sound = @bloopsaphone.sound(Bloops::SQUARE)
|
6
|
-
@sound.sustain = 1
|
7
|
-
|
8
|
-
@note = Note.new
|
9
|
-
end
|
10
|
-
|
11
|
-
def start
|
12
|
-
200.times do
|
13
|
-
@bloopsaphone.clear
|
14
|
-
if success?
|
15
|
-
@note.next!
|
16
|
-
else
|
17
|
-
@note.next!
|
18
|
-
# @note.prev!
|
19
|
-
end
|
20
|
-
|
21
|
-
@bloopsaphone.tune(@sound, @note.note)
|
22
|
-
@bloopsaphone.play
|
23
|
-
sleep 0.1 #while !@bloopsaphone.stopped?
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
def success?
|
30
|
-
rand(2) == 0
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
|
35
|
-
player = SoundPlayer.new
|
36
|
-
player.start
|