webster 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +21 -0
- data/README.textile +37 -0
- data/Rakefile +27 -0
- data/VERSION +1 -0
- data/lib/webster.rb +11 -0
- data/lib/words +113431 -0
- data/shoulda_macros/webster.rb +35 -0
- data/test/webster_test.rb +37 -0
- metadata +71 -0
@@ -0,0 +1,35 @@
|
|
1
|
+
class Webster
|
2
|
+
module Shoulda
|
3
|
+
# Example:
|
4
|
+
# context "Subscription#activation_code" do
|
5
|
+
# setup do
|
6
|
+
# subscription = Factory :subscription
|
7
|
+
# @code = subscription.set_activation_code
|
8
|
+
# end
|
9
|
+
#
|
10
|
+
# should_be_webster_word "@code"
|
11
|
+
#
|
12
|
+
def should_be_webster_word(word)
|
13
|
+
should "be webster word" do
|
14
|
+
word = eval word
|
15
|
+
assert_kind_of String, word,
|
16
|
+
"#{word} is not a string but is a #{word.class}."
|
17
|
+
assert_equal word, word.downcase,
|
18
|
+
"#{word} is not downcase"
|
19
|
+
assert word.length >= 5,
|
20
|
+
"#{word} should be greater than or equal to five characters long " <<
|
21
|
+
"but is #{word.length} characters long."
|
22
|
+
assert word.length <= 9,
|
23
|
+
"#{word} should be less than or equal to nine characters long " <<
|
24
|
+
"but is #{word.length} characters long."
|
25
|
+
assert_no_match /\n/, word,
|
26
|
+
"#{word} contains a carriage return."
|
27
|
+
assert Webster::DICTIONARY.include?(word),
|
28
|
+
"#{word} should be a word in the Webster dictionary"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
Test::Unit::TestCase.extend(Webster::Shoulda)
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'shoulda'
|
4
|
+
require File.join(File.dirname(__FILE__), '..', 'shoulda_macros', 'webster')
|
5
|
+
require File.join(File.dirname(__FILE__), "..", "lib", "webster")
|
6
|
+
|
7
|
+
class WebsterTest < Test::Unit::TestCase
|
8
|
+
|
9
|
+
context "#dictionary" do
|
10
|
+
setup do
|
11
|
+
@dictionary = Webster::DICTIONARY
|
12
|
+
@blacklist = %w(bastaard bastard bastardly bastardy bedamn bitch damnable damnably damnation
|
13
|
+
damnatory damned damner damnify damnii damning damningly damnonii damnous damnously
|
14
|
+
shita shitepoke shother shittah shittim undamned undamning undamn
|
15
|
+
assman whore whoredom whorelike whoreship whoreson whorish whorishly
|
16
|
+
hemipenis penis penistone vagina vaginal vaginant vaginate vaginated
|
17
|
+
vagina vaginal vaginant vaginate vaginated dildo dillweed dingus dinkum
|
18
|
+
swordick pussy anusim anusvara rectum dick nipple clitoria clitoris clitorism)
|
19
|
+
end
|
20
|
+
|
21
|
+
should "not contain offensive words or offensive-sounding words" do
|
22
|
+
@blacklist.each do |word|
|
23
|
+
assert ! @dictionary.include?(word), "The blacklist word, #{word}, is in the dictionary."
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
context "#random_word" do
|
29
|
+
setup do
|
30
|
+
webster = Webster.new
|
31
|
+
@word = webster.random_word
|
32
|
+
end
|
33
|
+
|
34
|
+
should_be_webster_word '@word'
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
metadata
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: webster
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 5
|
8
|
+
- 0
|
9
|
+
version: 0.5.0
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Dan Croak
|
13
|
+
- Jared Carroll
|
14
|
+
- thoughtbot
|
15
|
+
autorequire:
|
16
|
+
bindir: bin
|
17
|
+
cert_chain: []
|
18
|
+
|
19
|
+
date: 2010-06-06 00:00:00 -04:00
|
20
|
+
default_executable:
|
21
|
+
dependencies: []
|
22
|
+
|
23
|
+
description: Generate random short words. Good for human-readable confirmation codes.
|
24
|
+
email: dcroak@thoughtbot.com
|
25
|
+
executables: []
|
26
|
+
|
27
|
+
extensions: []
|
28
|
+
|
29
|
+
extra_rdoc_files:
|
30
|
+
- LICENSE
|
31
|
+
- README.textile
|
32
|
+
files:
|
33
|
+
- LICENSE
|
34
|
+
- README.textile
|
35
|
+
- Rakefile
|
36
|
+
- VERSION
|
37
|
+
- lib/webster.rb
|
38
|
+
- lib/words
|
39
|
+
- shoulda_macros/webster.rb
|
40
|
+
has_rdoc: true
|
41
|
+
homepage: http://github.com/dancroak/webster
|
42
|
+
licenses: []
|
43
|
+
|
44
|
+
post_install_message:
|
45
|
+
rdoc_options:
|
46
|
+
- --charset=UTF-8
|
47
|
+
require_paths:
|
48
|
+
- lib
|
49
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
segments:
|
54
|
+
- 0
|
55
|
+
version: "0"
|
56
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
segments:
|
61
|
+
- 0
|
62
|
+
version: "0"
|
63
|
+
requirements: []
|
64
|
+
|
65
|
+
rubyforge_project:
|
66
|
+
rubygems_version: 1.3.6
|
67
|
+
signing_key:
|
68
|
+
specification_version: 3
|
69
|
+
summary: Generate random short words. Good for human-readable confirmation codes.
|
70
|
+
test_files:
|
71
|
+
- test/webster_test.rb
|