Skip to content

Commit

Permalink
Merge branch 'hotfix/test_code_leak' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
smileart committed Jan 30, 2017
2 parents a630717 + bae2ca8 commit ba3e976
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

> Ruby wrapper around the modern version of the macOS `say` command. Inspired by the @bratta's [mactts](https://github.com/bratta/mactts)
>
> [![Build Status](https://travis-ci.org/smileart/mac-say.svg?branch=dev)](https://travis-ci.org/smileart/mac-say) [![Coverage Status](https://coveralls.io/repos/github/smileart/mac-say/badge.svg?branch=dev)](https://coveralls.io/github/smileart/mac-say?branch=dev) [![Code Climate](https://codeclimate.com/github/smileart/mac-say/badges/gpa.svg)](https://codeclimate.com/github/smileart/mac-say) [![InchCI Status](https://inch-ci.org/github/smileart/mac-say.svg?branch=dev)](https://inch-ci.org/github/smileart/mac-say)
> [![Build Status](https://travis-ci.org/smileart/mac-say.svg?branch=dev)](https://travis-ci.org/smileart/mac-say) [![Coverage Status](https://coveralls.io/repos/github/smileart/mac-say/badge.svg?branch=dev)](https://coveralls.io/github/smileart/mac-say?branch=dev) [![Code Climate](https://codeclimate.com/github/smileart/mac-say/badges/gpa.svg)](https://codeclimate.com/github/smileart/mac-say) [![InchCI Status](https://inch-ci.org/github/smileart/mac-say.svg?branch=dev)](https://inch-ci.org/github/smileart/mac-say) [![mac-say gem](https://img.shields.io/gem/v/mac-say.svg)](https://rubygems.org/gems/mac-say)
* [Homepage](https://rubygems.org/gems/mac-say)
* [Documentation](http://rubydoc.info/gems/mac-say/frames)
Expand Down
3 changes: 1 addition & 2 deletions lib/mac/say.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ def self.voice(feature, name)
# @raise [UnknownVoiceFeature] if the voice feature isn't supported
def voice(feature, value)
raise UnknownVoiceFeature, "Voice has no '#{feature}' feature" unless [:name, :language, :country].include?(feature)
value = value.to_sym

condition = feature == :name ? ->(v) { v[feature] == value } : ->(v) { v[:iso_code][feature] == value }
found_voices = @voices.find_all(&condition)
Expand Down Expand Up @@ -273,5 +274,3 @@ def valid_file_path?(path)
end
end
end

p Mac::Say.voice(:name, 'fuck')
5 changes: 5 additions & 0 deletions test/test_mac-say.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@
voice[:name].must_equal :alex
end

it '.voice must accept String as a value' do
voice = Mac::Say.voice(:name, 'alex')
voice[:name].must_equal :alex
end

it '.voice must search for a voice by country' do
voice = Mac::Say.voice(:country, :scotland)
voice[:name].must_equal :fiona
Expand Down

0 comments on commit ba3e976

Please sign in to comment.