Skip to content

Commit

Permalink
Add major and minor keys to music (#720)
Browse files Browse the repository at this point in the history
  • Loading branch information
andy-j authored and stympy committed Dec 19, 2016
1 parent 54a0199 commit acc2dc0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/faker/music.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ def key_variants
['b', '#', '']
end

def key_types
['', 'm']
end

def chord_types
['', 'maj', '6', 'maj7', 'm', 'm7', '-7', '7', 'dom7', 'dim', 'dim7', 'm7b5']
end
Expand Down
9 changes: 8 additions & 1 deletion test/test_faker_music.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ def test_key_variants
end
end

def test_key_types
assert @tester.key_types.size == 2
@tester.key_types.each do |key_type|
assert !key_type.nil?
end
end

def test_chord_types
assert @tester.chord_types.size == 12
@tester.chord_types.each do |chord_type|
Expand All @@ -28,7 +35,7 @@ def test_chord_types
end

def test_key
assert @tester.name.match(/([A-Z])+(b|#){0,1}/)
assert @tester.name.match(/([A-Z])+(b|#){0,1}+(m){0,1}/)
end

def test_instrument
Expand Down

0 comments on commit acc2dc0

Please sign in to comment.