rumm 0.0.21 → 0.0.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/providers/naming_provider.rb +9 -5
- data/lib/rumm/version.rb +1 -1
- data/spec/providers/naming_provider_spec.rb +18 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f22e1d300f41259fb41cf025ec307c54f085721f
|
4
|
+
data.tar.gz: f8b7f55420594715eabf95a79de2618e15d07395
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fc311104ba0b6212b14799692362c6457091b44e0913ee5cd77e4e457cc284c24a79834a1f7233173078490e9c06877cf6cef0a6faab504823f31eb10cec1ee
|
7
|
+
data.tar.gz: 320fc0ff3e01760fbc05fc08a5562449c54651441a2ceb8339bebe1d011339c2e6135ec45d5577ec3160436f2af6785d1ddb4ab95df6a3f01907f07e1502e32c
|
data/README.md
CHANGED
@@ -6,8 +6,8 @@ class NamingProvider
|
|
6
6
|
self
|
7
7
|
end
|
8
8
|
|
9
|
-
def generate_name(
|
10
|
-
"#{adjective
|
9
|
+
def generate_name(adj_first_letter = nil, noun_first_letter = nil)
|
10
|
+
"#{adjective adj_first_letter}-#{noun noun_first_letter}"
|
11
11
|
end
|
12
12
|
|
13
13
|
def random_letter
|
@@ -26,12 +26,16 @@ class NamingProvider
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def noun(first_letter)
|
29
|
-
|
30
|
-
list[rand(list.length - 1)]
|
29
|
+
word 'nouns', first_letter
|
31
30
|
end
|
32
31
|
|
33
32
|
def adjective(first_letter)
|
34
|
-
|
33
|
+
word 'adjectives', first_letter
|
34
|
+
end
|
35
|
+
|
36
|
+
def word(type, first_letter)
|
37
|
+
first_letter ||= random_letter
|
38
|
+
list = dictionary(type)[first_letter]
|
35
39
|
list[rand(list.length - 1)]
|
36
40
|
end
|
37
41
|
end
|
data/lib/rumm/version.rb
CHANGED
@@ -10,6 +10,24 @@ describe "fancy naming" do
|
|
10
10
|
Then { not name.nil? }
|
11
11
|
Then { name.length > 1}
|
12
12
|
end
|
13
|
+
context "with nil arguments" do
|
14
|
+
Given(:parts) { name.split '-' }
|
15
|
+
context "both nil" do
|
16
|
+
Given(:arguments) { [nil, nil] }
|
17
|
+
Then { parts.first[0] != nil}
|
18
|
+
Then { parts.last[0] != nil }
|
19
|
+
end
|
20
|
+
context "adjective nil" do
|
21
|
+
Given(:arguments) { [nil, 'z'] }
|
22
|
+
Then { parts.first[0] != nil}
|
23
|
+
Then { parts.last[0] == 'z' }
|
24
|
+
end
|
25
|
+
context "noun nil" do
|
26
|
+
Given(:arguments) { ['x', nil] }
|
27
|
+
Then { parts.first[0] == 'x'}
|
28
|
+
Then { parts.last[0] != nil }
|
29
|
+
end
|
30
|
+
end
|
13
31
|
context "with a first letter and last letter" do
|
14
32
|
Given(:parts) { name.split '-' }
|
15
33
|
context "with different letters" do
|