spec/parsing/convenience_methods_spec.rb in music-transcription-0.10.0 vs spec/parsing/convenience_methods_spec.rb in music-transcription-0.11.0
- old
+ new
@@ -39,19 +39,29 @@
'/2 /2 /4' => [Note::half,Note::half,Note::quarter],
"/4C4 \t /4D4" => [Note::quarter([C4]),Note::quarter([D4])],
"/2Db2\t/2C2 \n /2C2" => [Note::half([Db2]), Note::half([C2]), Note::half([C2])]
}]
+meter_stuff = ['should parse as meter',
{
+ '2/2' => Meter.new(2,"1/2".to_r),
+ "4/4" => Meter.new(4,"1/4".to_r),
+ "6/8" => Meter.new(6,"1/8".to_r),
+ "12/3" => Meter.new(12,"1/3".to_r),
+ "133/55" => Meter.new(133,"1/55".to_r),
+}]
+
+{
:duration => dur_stuff,
:dur => dur_stuff,
:durations => durs_stuff,
:durs => durs_stuff,
:pitch => pitch_stuff,
:pitches => pitches_stuff,
:note => note_stuff,
- :notes => notes_stuff
+ :notes => notes_stuff,
+ :meter => meter_stuff
}.each do |mod_fun,descr_cases|
describe("Parsing::" + mod_fun.to_s) do
descr, cases = descr_cases
it descr do
cases.each do |s,tgt|
@@ -73,10 +83,11 @@
:to_ps=> pitches_stuff,
:to_pitches => pitches_stuff,
:to_n => note_stuff,
:to_note => note_stuff,
:to_ns => notes_stuff,
- :to_notes => notes_stuff
+ :to_notes => notes_stuff,
+ :to_meter => meter_stuff,
}.each do |inst_meth,descr_cases|
describe("String#" + inst_meth.to_s) do
descr, cases = descr_cases
it descr do
cases.each do |s,tgt|