Skip to content

Commit

Permalink
close #3
Browse files Browse the repository at this point in the history
  • Loading branch information
MarioRuiz committed Mar 20, 2020
1 parent d93a5a9 commit 829d03a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/string/pattern/add_to_ruby.rb
Expand Up @@ -37,7 +37,7 @@ def validate(string_to_validate, expected_errors: [], not_expected_errors: [], *
def to_camel_case
return self if self !~ /_/ && self !~ /\s/ && self =~ /^[A-Z]+.*/

gsub(/\W/, "_")
gsub(/[^a-zA-Z0-9ññÑáéíóúÁÉÍÓÚüÜ_]/, "_")
.split("_").map(&:capitalize).join
end
end
Expand Down
3 changes: 3 additions & 0 deletions spec/string/pattern/add_to_ruby_spec.rb
Expand Up @@ -32,6 +32,9 @@
it "responds to to_camel_case" do
expect("ccccc aaa".to_camel_case).to eq "CccccAaa"
end
it 'returns camel case of Spanish characters' do
expect("caña de albóndiga".to_camel_case).to eq "CañaDeAlbóndiga"
end
end

describe "symbol class" do
Expand Down
2 changes: 1 addition & 1 deletion string_pattern.gemspec
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = 'string_pattern'
s.version = '2.2.1'
s.version = '2.2.2'
s.summary = "Generate easily random strings following a simple pattern or regular expression. '10-20:Xn/x/'.generate #>qBstvc6JN8ra. Also generate words in English or Spanish. Perfect to be used in test data factories."
s.description = "Easily generate strings supplying a very simple pattern. '10-20:Xn/x/'.generate #>qBstvc6JN8ra. Generate random strings using a regular expression (Regexp): /[a-z0-9]{2,5}\w+/.gen . Also generate words in English or Spanish. Perfect to be used in test data factories. Also, validate if a text fulfills a specific pattern or even generate a string following a pattern and returning the wrong length, value... for testing your applications."
s.authors = ["Mario Ruiz"]
Expand Down

0 comments on commit 829d03a

Please sign in to comment.