summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2015-03-09 11:16:05 +0000
committerintrigeri <intrigeri@boum.org>2015-03-09 11:16:05 +0000
commitccda39cd436ce866a946a2e21fb8803b252d9a81 (patch)
treed99c0f3d9937a887ba2bd4ec713d445eadb78bc1
parent5fe8d9c30f2b687c451881331a0ee6097803dcff (diff)
Name newly introduced functions (that have no side effect) depending on what they return, instead of what they do.test/8001-8002-pidgin-xmp-otr-intrigeri
-rw-r--r--features/step_definitions/pidgin.rb2
-rw-r--r--features/support/helpers/misc_helpers.rb10
2 files changed, 6 insertions, 6 deletions
diff --git a/features/step_definitions/pidgin.rb b/features/step_definitions/pidgin.rb
index 1329b1b..d03c4a7 100644
--- a/features/step_definitions/pidgin.rb
+++ b/features/step_definitions/pidgin.rb
@@ -126,7 +126,7 @@ When /^I join some empty multi-user chat$/ do
!account["chat_room"].empty?
chat_room = account["chat_room"]
else
- chat_room = generate_random_alnum_string(10,15)
+ chat_room = random_alnum_string(10,15)
end
@screen.type(chat_room)
diff --git a/features/support/helpers/misc_helpers.rb b/features/support/helpers/misc_helpers.rb
index 2be06b6..0d1b958 100644
--- a/features/support/helpers/misc_helpers.rb
+++ b/features/support/helpers/misc_helpers.rb
@@ -115,16 +115,16 @@ end
ALPHA_SET = ('A'..'Z').to_a + ('a'..'z').to_a
ALNUM_SET = ALPHA_SET + (0..9).to_a.map { |n| n.to_s }
-def generate_random_string_from_set(set, min_len, max_len)
+def random_string_from_set(set, min_len, max_len)
len = (min_len..max_len).to_a.sample
len ||= min_len
set.sample(len).join
end
-def generate_random_alpha_string(min_len, max_len = 0)
- generate_random_string_from_set(ALPHA_SET, min_len, max_len)
+def random_alpha_string(min_len, max_len = 0)
+ random_string_from_set(ALPHA_SET, min_len, max_len)
end
-def generate_random_alnum_string(min_len, max_len = 0)
- generate_random_string_from_set(ALNUM_SET, min_len, max_len)
+def random_alnum_string(min_len, max_len = 0)
+ random_string_from_set(ALNUM_SET, min_len, max_len)
end