Skip to content

Commit

Permalink
Case-insensitive language for user_display_message
Browse files Browse the repository at this point in the history
  • Loading branch information
incarnate committed Mar 1, 2016
1 parent 9347d43 commit f078d8b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/eway_rapid/rapid_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def settlement_search(search_request)
# @param [String] language The 2 letter code for the language to translate to (only en at this time)
# @return [String] Error message
def self.user_display_message(code, language = 'en')
find_error_code(code, language)
find_error_code(code, language.downcase)
end

# Gets the valid status of this Rapid client
Expand Down
6 changes: 6 additions & 0 deletions test/eway_rapid/rapid_client_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,10 @@ def test_find_error_code
error_code = 'S9991'
assert_equal('Library does not have PublicAPI key initialised, or Key is Invalid', EwayRapid::RapidClient.user_display_message(error_code))
end

def test_find_error_code_with_langugage
error_code = 'S9991'
assert_equal('Library does not have PublicAPI key initialised, or Key is Invalid', EwayRapid::RapidClient.user_display_message(error_code, 'en'))
assert_equal('Library does not have PublicAPI key initialised, or Key is Invalid', EwayRapid::RapidClient.user_display_message(error_code, 'EN'))
end
end

0 comments on commit f078d8b

Please sign in to comment.