Skip to content

Commit

Permalink
fixing scale to return Fmaj properly
Browse files Browse the repository at this point in the history
  • Loading branch information
jwoertink committed Oct 21, 2016
1 parent 1577877 commit 473d85e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
5 changes: 5 additions & 0 deletions spec/note_spec.cr
Expand Up @@ -77,6 +77,11 @@ describe Medley::Note do
note.wholestep_up.should eq "Bb"
end

it "returns C when given Bb" do
note = Medley::Note.new("Bb")
note.wholestep_up.should eq "C"
end

it "returns Dbb when given Cbb" do
note = Medley::Note.new("Cbb")
note.wholestep_up.should eq "Dbb"
Expand Down
8 changes: 4 additions & 4 deletions spec/scale_spec.cr
Expand Up @@ -8,10 +8,10 @@ describe Medley::Scale do
scale.notes.should eq(["C", "D", "E", "F", "G", "A", "B", "C"])
end

#it "returns an array of letters in F major scale order" do
# scale = Medley::Scale.new("Fmaj")
# scale.notes.should eq(["F", "G", "A", "Bb", "C", "D", "E", "F"])
#end
it "returns an array of letters in F major scale order" do
scale = Medley::Scale.new("Fmaj")
scale.notes.should eq(["F", "G", "A", "Bb", "C", "D", "E", "F"])
end

it "returns an array of letters in D Major scale order" do
scale = Medley::Scale.new("Dmaj")
Expand Down
6 changes: 2 additions & 4 deletions src/medley/note.cr
Expand Up @@ -94,10 +94,8 @@ module Medley
def wholestep_up
up_halfstep = Note.new(halfstep_up)
new_note = Note.new(up_halfstep.halfstep_up)
if new_note.double_sharp?
ALIASES[new_note.name]
elsif new_note.root_matches?(self)
new_note.next_root + name[1..-1]
if new_note.double_sharp? || new_note.root_matches?(self)
ALIASES[new_note.name]? || new_note.next_root + name[1..-1]
else
new_note.name
end
Expand Down
2 changes: 1 addition & 1 deletion src/medley/version.cr
@@ -1,3 +1,3 @@
module Medley
VERSION = "0.3.1"
VERSION = "0.3.2"
end

0 comments on commit 473d85e

Please sign in to comment.