You are here: Browse Railsplugins Codesmanship
Adds assertions for enforcing Ruby coding conventions.
test/unit/codesmanship_test.rb
class TestCodesmanship < Test::Unit::TestCase
def test_should_restrict_maximum_line_length
assert_restriction_of_line_length 120
end
def test_should_find_blank_lines_with_extra_spaces
assert_codesmanship_on :ruby, " $", "Remove extra whitespace at the end of the line"
assert_codesmanship_on :views, " $", "Remove extra whitespace at the end of the line"
end
def test_should_find_hash_with_no_spaces
assert_codesmanship_on :ruby, '\b=>\b', "Use :key => value"
assert_codesmanship_on :views, '\b=>\b', "Use :key => value"
end
def test_should_find_method_with_no_extra_spaces_in_their_default_arguments
assert_codesmanship_on :ruby, 'def .\((.[a-z]=.*)\)', "Use def foo(options = {})"
end
end
Copyright© 2007 Joshua Peek, released under the MIT license
NOTE: This description has been extracted from the Plugin README and so the formatting may need updating to make browser friendly
Homepage: http://projects.wh.joshpeek.com/browser/plugins/codesmanship