midi-instrument 0.4.4 → 0.4.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: de2e68fe21480e1b6d6f73cdf1c1b727c3a7a5c6
4
- data.tar.gz: e1b05fad7f4dfeb87adc831341cdaf3df33d002c
3
+ metadata.gz: 061fda3764586277dbd8a7e8c863e22ce7eaec1d
4
+ data.tar.gz: b48bb43e5bf7433e490623197f6b93126c4894c0
5
5
  SHA512:
6
- metadata.gz: 8c28ecdda76b199c7bcd9131743795dd86fef348320f5522e4a481d689e6fe4edf7ad95efc58715624fc821761ebb96d37f8e78bd533c75e07dce8e21209679e
7
- data.tar.gz: 98264b8629ee79c7261a260e0001f8da50f3ca0a7e5e6dca8a0b635ac531538f42ad4d6b0b8704f23296f33614d456861b841d46b6d9ac4b35e1be595ea676f6
6
+ metadata.gz: 3c9712f98ea2b32d3b7f621009f3e9cbcdbf97ae942be67dec1b355f59567af00685cb8e1d44e8f09db09a5e5cf9f17e3f2394304772810b57ecbd9b03321bc0
7
+ data.tar.gz: bbb595a4688154d048c0475b534f16c5c75063dba28f2796f33222c2ca6592786b727109a990c8c4462a03e83650cfb6cc46c8b32e4e1920d5050d216085fd47
@@ -4,7 +4,7 @@
4
4
  #
5
5
  # (c)2011-2014 Ari Russo
6
6
  # Licensed under Apache 2.0
7
- #
7
+ #
8
8
 
9
9
  # libs
10
10
  require "forwardable"
@@ -26,7 +26,7 @@ require "midi-instrument/note_event"
26
26
  require "midi-instrument/output"
27
27
 
28
28
  module MIDIInstrument
29
-
30
- VERSION = "0.4.4"
31
-
29
+
30
+ VERSION = "0.4.5"
31
+
32
32
  end
@@ -1,6 +1,6 @@
1
1
  require "helper"
2
2
 
3
- class MIDIInstrument::DeviceTest < Test::Unit::TestCase
3
+ class MIDIInstrument::DeviceTest < Minitest::Test
4
4
 
5
5
  context "Device" do
6
6
 
@@ -11,10 +11,10 @@ class MIDIInstrument::DeviceTest < Test::Unit::TestCase
11
11
  outputs = UniMIDI::Output.all
12
12
  devices = inputs + outputs
13
13
  result = MIDIInstrument::Device.partition(devices)
14
- assert_not_nil result
14
+ refute_nil result
15
15
  assert result.kind_of?(Hash)
16
- assert_not_nil result[:input]
17
- assert_not_nil result[:output]
16
+ refute_nil result[:input]
17
+ refute_nil result[:output]
18
18
  assert_equal inputs, result[:input]
19
19
  assert_equal outputs, result[:output]
20
20
  end
@@ -23,4 +23,3 @@ class MIDIInstrument::DeviceTest < Test::Unit::TestCase
23
23
  end
24
24
 
25
25
  end
26
-
@@ -1,18 +1,18 @@
1
1
  dir = File.dirname(File.expand_path(__FILE__))
2
2
  $LOAD_PATH.unshift dir + "/../lib"
3
3
 
4
- require "test/unit"
4
+ require "minitest/autorun"
5
5
  require "mocha/test_unit"
6
6
  require "shoulda-context"
7
7
  require "midi-instrument"
8
8
 
9
9
  module TestHelper
10
-
10
+
11
11
  def self.select_devices
12
12
  $test_device ||= {}
13
13
  { :input => UniMIDI::Input, :output => UniMIDI::Output }.each do |type, klass|
14
14
  $test_device[type] = klass.gets
15
15
  end
16
16
  end
17
-
17
+
18
18
  end
@@ -1,6 +1,6 @@
1
1
  require "helper"
2
2
 
3
- class MIDIInstrument::InputTest < Test::Unit::TestCase
3
+ class MIDIInstrument::InputTest < Minitest::Test
4
4
 
5
5
  include Mocha::ParameterMatchers
6
6
 
@@ -14,12 +14,12 @@ class MIDIInstrument::InputTest < Test::Unit::TestCase
14
14
 
15
15
  should "add callback" do
16
16
  match = { :class => MIDIMessage::NoteOn }
17
- block = proc { puts "hello" }
17
+ block = proc { puts "hello from the callback" }
18
18
  MIDIInstrument::Listener.any_instance.expects(:receive).once.with(match).yields(block)
19
19
  result = @input.receive(match, &block)
20
20
  assert_equal @input, result
21
21
  end
22
-
22
+
23
23
  end
24
24
 
25
25
  context "#add" do
@@ -36,13 +36,13 @@ class MIDIInstrument::InputTest < Test::Unit::TestCase
36
36
 
37
37
  should "not suppress unknown objects" do
38
38
  MIDIInstrument::Listener.any_instance.expects(:add).never
39
- assert_raise(NoMethodError) { @input.add("hello", "how", "are", "you") }
39
+ assert_raises(NoMethodError) { @input.add("hello", "how", "are", "you") }
40
40
  end
41
41
 
42
42
  end
43
43
 
44
44
  context "#omni" do
45
-
45
+
46
46
  should "not have a receive channel" do
47
47
  @input.channel = 4
48
48
  assert_equal 4, @input.channel
@@ -82,5 +82,3 @@ class MIDIInstrument::InputTest < Test::Unit::TestCase
82
82
  end
83
83
 
84
84
  end
85
-
86
-
@@ -1,6 +1,6 @@
1
1
  require "helper"
2
2
 
3
- class MIDIInstrument::ListenerTest < Test::Unit::TestCase
3
+ class MIDIInstrument::ListenerTest < Minitest::Test
4
4
 
5
5
  context "Listener" do
6
6
 
@@ -13,13 +13,13 @@ class MIDIInstrument::ListenerTest < Test::Unit::TestCase
13
13
 
14
14
  should "output hashes with timestamps" do
15
15
  notes = [
16
- MIDIMessage::NoteOn["C3"].new(3, 100),
17
- MIDIMessage::NoteOn["B4"].new(5, 100),
16
+ MIDIMessage::NoteOn["C3"].new(3, 100),
17
+ MIDIMessage::NoteOn["B4"].new(5, 100),
18
18
  MIDIMessage::NoteOn["D7"].new(7, 100)
19
19
  ]
20
20
  result = @listener.add(*notes)
21
- assert_not_nil result
22
- assert_not_empty result
21
+ refute_nil result
22
+ refute_empty result
23
23
  assert result.all? { |r| r.kind_of?(Hash) }
24
24
  refute result.any? { |r| r[:timestamp].nil? }
25
25
  end
@@ -1,6 +1,6 @@
1
1
  require "helper"
2
2
 
3
- class MIDIInstrument::MessageTest < Test::Unit::TestCase
3
+ class MIDIInstrument::MessageTest < Minitest::Test
4
4
 
5
5
  context "Message" do
6
6
 
@@ -9,8 +9,8 @@ class MIDIInstrument::MessageTest < Test::Unit::TestCase
9
9
  should "convert strings to note on messages" do
10
10
  names = ["A-1", "C#4", "F#5", "D6"]
11
11
  result = MIDIInstrument::Message.to_messages(*names)
12
- assert_not_nil result
13
- assert_not_empty result
12
+ refute_nil result
13
+ refute_empty result
14
14
  assert_equal names.size, result.size
15
15
  assert result.all? { |item| item.is_a?(MIDIMessage::NoteOn) }
16
16
  names.each_with_index { |name, i| assert_equal name, result[i].name }
@@ -20,8 +20,8 @@ class MIDIInstrument::MessageTest < Test::Unit::TestCase
20
20
  names = ["A-1", "C#4", "F#5", "D6"]
21
21
  messages = MIDIInstrument::Message.to_messages(*names)
22
22
  result = MIDIInstrument::Message.to_messages(*messages)
23
- assert_not_nil result
24
- assert_not_empty result
23
+ refute_nil result
24
+ refute_empty result
25
25
  assert result.all? { |message| message.is_a?(MIDIMessage::NoteOn) }
26
26
  messages.each_with_index { |message,i| assert_equal message.note, result[i].note }
27
27
  end
@@ -38,8 +38,8 @@ class MIDIInstrument::MessageTest < Test::Unit::TestCase
38
38
  names = ["A-1", "C#4", "F#5", "D6"]
39
39
  messages = MIDIInstrument::Message.to_messages(*names)
40
40
  result = MIDIInstrument::Message.to_bytes(*messages)
41
- assert_not_nil result
42
- assert_not_empty result
41
+ refute_nil result
42
+ refute_empty result
43
43
  assert result.all? { |item| item.is_a?(Fixnum) }
44
44
  assert_equal messages.map(&:to_a).flatten, result
45
45
  end
@@ -48,8 +48,8 @@ class MIDIInstrument::MessageTest < Test::Unit::TestCase
48
48
  names = ["A-1", "C#4", "F#5", "D6"]
49
49
  messages = MIDIInstrument::Message.to_messages(*names)
50
50
  result = MIDIInstrument::Message.to_bytes(*names)
51
- assert_not_nil result
52
- assert_not_empty result
51
+ refute_nil result
52
+ refute_empty result
53
53
  assert result.all? { |item| item.is_a?(Fixnum) }
54
54
  assert_equal messages.map(&:to_a).flatten, result
55
55
  end
@@ -57,8 +57,8 @@ class MIDIInstrument::MessageTest < Test::Unit::TestCase
57
57
  should "pass bytes" do
58
58
  bytes = [144, 9, 100, 144, 61, 100, 144, 78, 100, 144, 86, 100]
59
59
  result = MIDIInstrument::Message.to_bytes(*bytes)
60
- assert_not_nil result
61
- assert_not_empty result
60
+ refute_nil result
61
+ refute_empty result
62
62
  assert result.all? { |item| item.is_a?(Fixnum) }
63
63
  assert_equal bytes, result
64
64
  end
@@ -74,8 +74,8 @@ class MIDIInstrument::MessageTest < Test::Unit::TestCase
74
74
  should "convert strings to note off" do
75
75
  names = ["A-1", "C#4", "F#5", "D6"]
76
76
  result = MIDIInstrument::Message.to_note_offs(*names)
77
- assert_not_nil result
78
- assert_not_empty result
77
+ refute_nil result
78
+ refute_empty result
79
79
  assert_equal names.size, result.size
80
80
  assert result.all? { |item| item.is_a?(MIDIMessage::NoteOff) }
81
81
  names.each_with_index { |name, i| assert_equal name, result[i].name }
@@ -85,15 +85,15 @@ class MIDIInstrument::MessageTest < Test::Unit::TestCase
85
85
  names = ["A-1", "C#4", "F#5", "D6"]
86
86
  messages = MIDIInstrument::Message.to_messages(*names)
87
87
  result = MIDIInstrument::Message.to_note_offs(*messages)
88
- assert_not_nil result
89
- assert_not_empty result
88
+ refute_nil result
89
+ refute_empty result
90
90
  assert result.all? { |message| message.is_a?(MIDIMessage::NoteOff) }
91
91
  messages.each_with_index { |message,i| assert_equal message.note, result[i].note }
92
92
  end
93
93
 
94
94
  should "return nil for unknowns" do
95
95
  result = MIDIInstrument::Message.to_note_offs("blah", "blah", 56904)
96
- assert_not_nil result
96
+ refute_nil result
97
97
  assert_equal 3, result.size
98
98
  assert_empty result.compact
99
99
  end
@@ -105,8 +105,8 @@ class MIDIInstrument::MessageTest < Test::Unit::TestCase
105
105
  should "convert strings to note ons" do
106
106
  names = ["A-1", "C#4", "F#5", "D6"]
107
107
  result = MIDIInstrument::Message.to_note_ons(*names)
108
- assert_not_nil result
109
- assert_not_empty result
108
+ refute_nil result
109
+ refute_empty result
110
110
  assert_equal names.size, result.size
111
111
  assert result.all? { |item| item.is_a?(MIDIMessage::NoteOn) }
112
112
  names.each_with_index { |name, i| assert_equal name, result[i].name }
@@ -116,23 +116,20 @@ class MIDIInstrument::MessageTest < Test::Unit::TestCase
116
116
  names = ["A-1", "C#4", "F#5", "D6"]
117
117
  messages = MIDIInstrument::Message.to_messages(*names)
118
118
  result = MIDIInstrument::Message.to_note_ons(*messages)
119
- assert_not_nil result
120
- assert_not_empty result
119
+ refute_nil result
120
+ refute_empty result
121
121
  messages.each_with_index { |message,i| assert_equal message.note, result[i].note }
122
122
  end
123
123
 
124
124
  should "return nil for unknowns" do
125
125
  result = MIDIInstrument::Message.to_note_ons("blah", "blah", 56904)
126
- assert_not_nil result
126
+ refute_nil result
127
127
  assert_equal 3, result.size
128
128
  assert_empty result.compact
129
129
  end
130
130
 
131
131
  end
132
-
132
+
133
133
  end
134
134
 
135
135
  end
136
-
137
-
138
-
@@ -1,6 +1,6 @@
1
1
  require "helper"
2
2
 
3
- class MIDIInstrument::NoteEventTest < Test::Unit::TestCase
3
+ class MIDIInstrument::NoteEventTest < Minitest::Test
4
4
 
5
5
  context "NoteEvent" do
6
6
 
@@ -13,7 +13,7 @@ class MIDIInstrument::NoteEventTest < Test::Unit::TestCase
13
13
  assert_equal(10, event.duration)
14
14
  assert_equal(MIDIMessage::NoteOff, event.finish.class)
15
15
  assert_equal(msg.note, event.finish.note)
16
- assert_equal(msg.note, event.note)
16
+ assert_equal(msg.note, event.note)
17
17
  end
18
18
 
19
19
  should "override finish" do
@@ -1,6 +1,6 @@
1
1
  require "helper"
2
2
 
3
- class MIDIInstrument::OutputTest < Test::Unit::TestCase
3
+ class MIDIInstrument::OutputTest < Minitest::Test
4
4
 
5
5
  include Mocha::ParameterMatchers
6
6
 
@@ -28,14 +28,14 @@ class MIDIInstrument::OutputTest < Test::Unit::TestCase
28
28
  end
29
29
 
30
30
  should "output to multiple devices" do
31
- 4.times do
31
+ 4.times do
32
32
  @output.devices << Object.new
33
33
  end
34
34
  names = ["A-1", "C#4", "F#5", "D6"]
35
35
  @output.devices.each { |device| device.expects(:puts).once }
36
36
  result = @output.puts(*names)
37
37
  end
38
-
38
+
39
39
  end
40
40
 
41
41
  context "#mute" do
@@ -66,13 +66,13 @@ class MIDIInstrument::OutputTest < Test::Unit::TestCase
66
66
  should "have filter when channel is specified" do
67
67
  assert_nil @output.instance_variable_get("@channel_filter")
68
68
  @output.channel = 3
69
- assert_not_nil @output.instance_variable_get("@channel_filter")
69
+ refute_nil @output.instance_variable_get("@channel_filter")
70
70
  assert_equal 3, @output.channel
71
71
  end
72
72
 
73
73
  should "not have filter when channel is nil" do
74
74
  @output.channel = 3
75
- assert_not_nil @output.instance_variable_get("@channel_filter")
75
+ refute_nil @output.instance_variable_get("@channel_filter")
76
76
  assert_equal 3, @output.channel
77
77
  @output.channel = nil
78
78
  assert_nil @output.instance_variable_get("@channel_filter")
@@ -95,6 +95,3 @@ class MIDIInstrument::OutputTest < Test::Unit::TestCase
95
95
  end
96
96
 
97
97
  end
98
-
99
-
100
-
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: midi-instrument
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ari Russo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-18 00:00:00.000000000 Z
11
+ date: 2015-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: midi-eye