/
helper.rb
39 lines (32 loc) · 1016 Bytes
/
helper.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
require 'rubygems'
require 'test/unit'
require 'shoulda'
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'sentient_user'
class Test::Unit::TestCase
end
class Person
include SentientUser
end
class User
include SentientUser
end
class AnonymousUser < User ; end
ExceptedWords = %w{ hackery hacky monkeypatching
ActiveRecord SentientUser SentientController
initializer config rakefile bokmann
sublicense MERCHANTABILITY NONINFRINGEMENT
}
def check_spelling_in_file(path_relative_to_gem_root)
path = "#{File.dirname(__FILE__)}/../#{path_relative_to_gem_root}"
begin
aspell_output = `cat #{path} | aspell list`
rescue => err
warn "You probably don't have aspell. On mac: brew install aspell --lang=en"
raise err
end
noticed_words = aspell_output.split($/)
misspellings = noticed_words - ExceptedWords
assert_equal [], misspellings
end