dancroak-webster 0.4.7 → 0.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Rakefile CHANGED
@@ -12,19 +12,20 @@ end
12
12
  desc "Run the test suite"
13
13
  task :default => :test
14
14
 
15
- begin
16
- require 'rubygems'
17
- require 'jeweler'
18
- Jeweler::Tasks.new do |s|
19
- s.name = "webster"
20
- s.summary = "Generate random short words. Good for human-readable confirmation codes."
21
- s.email = "dcroak@thoughtbot.com"
22
- s.homepage = "http://github.com/dancroak/webster"
23
- s.description = "Generate random short words. Good for human-readable confirmation codes."
24
- s.authors = ["Dan Croak"]
25
- s.files = FileList["[A-Z]*", "{lib,test,shoulda_macros}/**/*"]
26
- end
27
- rescue LoadError
28
- puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
15
+ spec = Gem::Specification.new do |s|
16
+ s.name = "webster"
17
+ s.version = "0.4.8"
18
+ s.summary = "Generate random short words. Good for human-readable confirmation codes."
19
+ s.email = "dcroak@thoughtbot.com"
20
+ s.homepage = "http://github.com/dancroak/webster"
21
+ s.description = "Generate random short words. Good for human-readable confirmation codes."
22
+ s.authors = ["Dan Croak", "Jared Carroll", "thoughtbot"]
23
+ s.files = FileList["[A-Z]*", "{lib,shoulda_macros}/**/*"]
29
24
  end
30
25
 
26
+ desc "Generate a gemspec file"
27
+ task :gemspec do
28
+ File.open("#{spec.name}.gemspec", 'w') do |f|
29
+ f.write spec.to_yaml
30
+ end
31
+ end
data/lib/webster.rb CHANGED
@@ -1,10 +1,10 @@
1
- module Webster
1
+ class Webster
2
2
 
3
3
  DICTIONARY = File.open(File.join(File.dirname(__FILE__), 'words')) do |file|
4
4
  file.readlines.collect {|each| each.chomp}
5
5
  end
6
6
 
7
- def random
7
+ def random_word
8
8
  DICTIONARY[rand(DICTIONARY.size)]
9
9
  end
10
10
 
metadata CHANGED
@@ -1,15 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dancroak-webster
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.7
4
+ version: 0.4.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Croak
8
+ - Jared Carroll
9
+ - thoughtbot
8
10
  autorequire:
9
11
  bindir: bin
10
12
  cert_chain: []
11
13
 
12
- date: 2008-12-12 00:00:00 -08:00
14
+ date: 2009-01-07 21:00:00 -08:00
13
15
  default_executable:
14
16
  dependencies: []
15
17
 
@@ -28,7 +30,6 @@ files:
28
30
  - VERSION.yml
29
31
  - lib/webster.rb
30
32
  - lib/words
31
- - test/webster_test.rb
32
33
  - shoulda_macros/webster.rb
33
34
  has_rdoc: false
34
35
  homepage: http://github.com/dancroak/webster
data/VERSION.yml DELETED
@@ -1,4 +0,0 @@
1
- ---
2
- patch: 7
3
- major: 0
4
- minor: 4
data/test/webster_test.rb DELETED
@@ -1,59 +0,0 @@
1
- require 'test/unit'
2
- require 'rubygems'
3
- require 'shoulda'
4
- require File.join(File.dirname(__FILE__), "..", "lib", "webster")
5
-
6
- class WebsterTest < Test::Unit::TestCase
7
-
8
- include Webster
9
-
10
- context "#dictionary" do
11
- setup do
12
- @dictionary = Webster::DICTIONARY
13
- @blacklist = %w(bastaard bastard bastardly bastardy bedamn bitch damnable damnably damnation
14
- damnatory damned damner damnify damnii damning damningly damnonii damnous damnously
15
- shita shitepoke shother shittah shittim undamned undamning undamn
16
- assman whore whoredom whorelike whoreship whoreson whorish whorishly
17
- hemipenis penis penistone vagina vaginal vaginant vaginate vaginated
18
- vagina vaginal vaginant vaginate vaginated dildo dillweed dingus dinkum
19
- swordick pussy anusim anusvara rectum dick nipple clitoria clitoris clitorism)
20
- end
21
-
22
- should "not contain offensive words or offensive-sounding words" do
23
- @blacklist.each do |word|
24
- assert !@dictionary.include?(word), "The blacklist word, #{word}, is in the dictionary."
25
- end
26
- end
27
- end
28
-
29
- context "#random" do
30
- setup do
31
- @random = random
32
- end
33
-
34
- should "be a word" do
35
- assert_kind_of String, @random
36
- end
37
-
38
- should "be downcase" do
39
- assert_equal @random, @random.downcase
40
- end
41
-
42
- should "be greater than or equal to five characters long" do
43
- assert @random.length >= 5, "#{@random.inspect}, length: #{@random.length}"
44
- end
45
-
46
- should "be less than or equal to nine characters long" do
47
- assert @random.length <= 9, "#{@random.inspect}, length: #{@random.length}"
48
- end
49
-
50
- should "not contain a carriage return" do
51
- assert_no_match /\n/, @random
52
- end
53
-
54
- should "be a word in the dictionary" do
55
- assert Webster::DICTIONARY.include?(@random)
56
- end
57
- end
58
-
59
- end