Skip to content

Commit

Permalink
test: configure usual HTML coverage along with the Coveralls
Browse files Browse the repository at this point in the history
docs: add a few missed methods params
refactor: rename the (#|.)voice `name` argument (value)
  • Loading branch information
smileart committed Feb 1, 2017
1 parent 61339cd commit 580f293
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
22 changes: 17 additions & 5 deletions lib/mac/say.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def self.say(string, voice = :alex)
# Providing file, voice or rate arguments changes instance state and influence
# all the subsequent #say calls unless they have their own custom arguments
#
# @param string [String] a text to read using say command
# @param string [String] a text to read using say command (default: nil)
# @param file [String] path to the file to read (default: nil)
# @param voice [Symbol] voice to be used by the say command (default: :alex)
# @param rate [Integer] speech rate in words per minute (default: 175) accepts values in (175..720)
Expand Down Expand Up @@ -126,18 +126,24 @@ def say(string: nil, file: nil, voice: nil, rate: nil)
execute_command(string)
end

# Find a voice by one of its features (e.g. :name, :language, :country)
# Find voice(s) by one of its features (e.g. :name, :language, :country)
#
# @param feature [Symbol] the feature to search voices by
# @param value [Symbol, String] the value of the feature to search voices by
#
# @return [Array<Hash>, Hash] an array with all the voices matched by the feature or
# a voice Hash if only one voice corresponds to the feature
#
# @raise [UnknownVoiceFeature] if the voice feature isn't supported
def self.voice(feature, name)
def self.voice(feature, value)
mac = new
mac.voice(feature, name)
mac.voice(feature, value)
end

# Find a voice by one of its features (e.g. :name, :language, :country)
# Find voice(s) by one of its features (e.g. :name, :language, :country)
#
# @param feature [Symbol] the feature to search voices by
# @param value [Symbol, String] the value of the feature to search voices by
#
# @return [Array<Hash>, Hash] an array with all the voices matched by the feature or
# a voice Hash if only one voice corresponds to the feature
Expand Down Expand Up @@ -251,6 +257,8 @@ def load_voices
# Checks voice existence by the name
# Loads voices if they weren't loaded before
#
# @param name [String, Symbol] the name of the voice to validate
#
# @return [Boolean] if the voices name in the list of voices
#
# @raise [CommandNotFound] if the say command wasn't found
Expand All @@ -261,13 +269,17 @@ def valid_voice?(name)

# Checks say command existence by the path
#
# @param path [String] the path of the `say` command to validate
#
# @return [Boolean] if the command exists and if it is executable
def valid_command_path?(path)
File.exist?(path) && File.executable?(path)
end

# Checks text file existence by the path
#
# @param path [String] the path of the text file validate
#
# @return [Boolean] if the file exists and if it is readable
def valid_file_path?(path)
path && File.exist?(path) && File.readable?(path)
Expand Down
10 changes: 7 additions & 3 deletions test/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,19 @@
require 'coveralls'
Coveralls.wear!

require 'simplecov'
SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new [
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
]
SimpleCov.start

begin
require 'bundler/setup'
rescue LoadError => error
abort error.message
end

require 'simplecov'
SimpleCov.start

require 'minitest/autorun'
require 'minitest/reporters'

Expand Down

0 comments on commit 580f293

Please sign in to comment.