From 61d515fc07180bf4c85d99ae1ecd4580ddc7584c Mon Sep 17 00:00:00 2001 From: Jeremy Woertink Date: Thu, 20 Oct 2016 18:21:53 -0700 Subject: [PATCH] rename Medley::Notes to Medley::Note --- spec/note_spec.cr | 32 +++++++++++++++++++++ spec/notes_spec.cr | 48 -------------------------------- spec/spec_helper.cr | 2 +- src/medley/{notes.cr => note.cr} | 4 +-- 4 files changed, 35 insertions(+), 51 deletions(-) create mode 100644 spec/note_spec.cr delete mode 100644 spec/notes_spec.cr rename src/medley/{notes.cr => note.cr} (95%) diff --git a/spec/note_spec.cr b/spec/note_spec.cr new file mode 100644 index 0000000..edaa0ea --- /dev/null +++ b/spec/note_spec.cr @@ -0,0 +1,32 @@ +require "./spec_helper" + +describe Medley::Note do + + describe ".halfstep_up" do + it "returns G# when given G" do + note = Medley::Note.new("G") + note.halfstep_up.should eq "G#" + end + + it "returns B# when given B" do + note = Medley::Note.new("B") + note.halfstep_up.should eq "B#" + end + + it "returns D## when given D#" do + note = Medley::Note.new("D#") + note.halfstep_up.should eq "D##" + end + + it "returns B when given Bb" do + note = Medley::Note.new("Bb") + note.halfstep_up.should eq "B" + end + + it "returns F## when given E##" do + note = Medley::Note.new("E##") + note.halfstep_up.should eq "F##" + end + end + +end diff --git a/spec/notes_spec.cr b/spec/notes_spec.cr deleted file mode 100644 index cfdd2cb..0000000 --- a/spec/notes_spec.cr +++ /dev/null @@ -1,48 +0,0 @@ -require "./spec_helper" - -describe Medley::Notes do - - describe ".halfstep_up" do - it "returns G# when given G" do - note = Medley::Notes.new("G") - note.halfstep_up.should eq "G#" - end - - it "returns B# when given B" do - note = Medley::Notes.new("B") - note.halfstep_up.should eq "B#" - end - - it "returns D## when given D#" do - note = Medley::Notes.new("D#") - note.halfstep_up.should eq "D##" - end - - it "returns B when given Bb" do - note = Medley::Notes.new("Bb") - note.halfstep_up.should eq "B" - end - - it "returns F## when given E##" do - note = Medley::Notes.new("E##") - note.halfstep_up.should eq "F##" - end - end - - #describe ".wholestep_up" do - # it "returns A when given G" do - # note = Medley::Notes.new("G") - # note.wholestep_up.should eq "A" - # end - - # it "returns F for Eb" do - # note = Medley::Notes.new("Eb") - # note.wholestep_up.should eq "F" - # end - - # it "returns F# for E" do - # note = Medley::Notes.new("E") - # note.wholestep_up.should eq "F#" - # end - #end -end diff --git a/spec/spec_helper.cr b/spec/spec_helper.cr index 767b910..09ae00e 100644 --- a/spec/spec_helper.cr +++ b/spec/spec_helper.cr @@ -1,3 +1,3 @@ require "spec" require "../src/medley" -require "../src/medley/notes" +require "../src/medley/note" diff --git a/src/medley/notes.cr b/src/medley/note.cr similarity index 95% rename from src/medley/notes.cr rename to src/medley/note.cr index 4f6a6e8..cc2eb8e 100644 --- a/src/medley/notes.cr +++ b/src/medley/note.cr @@ -1,5 +1,5 @@ module Medley - class Notes + class Note NOTE_NAMES = %w(A B C D E F G) ALIASES = {"A##": "B", "B##": "C#", "C##": "D", "D##": "E", "E##": "F#", "F##": "G", "G##": "A"} @@ -64,7 +64,7 @@ module Medley end def wholestep_up - new_note = Medley::Notes.new(halfstep_up, @current_note) + new_note = Note.new(halfstep_up, @current_note) new_note.halfstep_up end end