Permalink
Browse files

Failing test to ensure there are no misspellings in the README.rdoc file

Includes a constant in test/helper.rb to excuse certain words.
Requires aspell to be installed and available on the command line to
run the tests.
  • Loading branch information...
1 parent 3ee20fc commit b67a0e1a4512676e1b61cfb9cd77c9c6fff32a5f Troy Surrett committed Oct 3, 2012
Showing with 23 additions and 4 deletions.
  1. +5 −0 test/helper.rb
  2. +18 −4 test/test_sentient_user.rb
View
5 test/helper.rb
@@ -18,3 +18,8 @@ class User
end
class AnonymousUser < User ; end
+
+ExceptedWords = %w{ hackery hacky monkeypatching
+ ActiveRecord SentientUser SentientController
+ initializer config rakefile bokmann
+ }
View
22 test/test_sentient_user.rb
@@ -6,23 +6,23 @@ class TestSentientUser < Test::Unit::TestCase
p.make_current
assert_equal Person.current, p
end
-
+
should "allow making the 'user' class sentient" do
u = User.new
u.make_current
assert_equal User.current, u
end
-
+
should "not allow making Person.current a user" do
assert_raise ArgumentError do
Person.current = User.new
end
end
-
+
should "allow making person.current a person" do
Person.current = Person.new
end
-
+
should "allow subclasses of user to be assigned to user.current" do
User.current = AnonymousUser.new
end
@@ -46,4 +46,18 @@ class TestSentientUser < Test::Unit::TestCase
assert_equal Person.current, p
end
end
+
+ should "have no spelling errors in its README" do
+ begin
+ aspell_output = `cat #{File.dirname(__FILE__)}/../README.rdoc | aspell list`
+ rescue => err
+ warn "You probably don't have aspell. On mac: brew install aspell --lang=en"
+ raise err
+ end
+ misspellings = aspell_output.split($/) - ExceptedWords
+ assert_equal [], misspellings
+ end
+
+ # should "have no spelling errors in the license" do
+ # end
end

0 comments on commit b67a0e1

Please sign in to comment.