class Relevance::Tarantula::MissingI18nTranslationHtmlHandler
include Relevance::Tarantula
def handle(result)
begin
response = result.response
return unless response.html?
if /translation missing/.match(response.body)
error_result = result.dup
error_result.success = false
error_result.description = "Broken Translation"
error_result
end
rescue
end
return nil
end
end
class TarantulaTest < ActionController::IntegrationTest
fixtures :all
require 'ruby-debug'
def test_tarantula
login_all_users
t = tarantula_crawler(self)
t.handlers << Relevance::Tarantula::MissingI18nTranslationHtmlHandler.new
t.crawl "/"
end
def login_all_users
end
end
Showing posts with label tarantula. Show all posts
Showing posts with label tarantula. Show all posts
Friday, April 9, 2010
Rails - Tarantula spider testing - finding broken I18n translations
Again with Tarantula - here a way to test all pages for missing translations while you are spidering.
RAILS - tarantula
Tarantula and excellent rails fuzzy spider. But its doc sucks..
Dont unpack it. Total waste of space and time... load it from the gem install location it like this
The docs advise to unpack the gem into the vendors dir... and then add this the rake file
load File.join(RAILS_ROOT, Dir["vendor/gems/tarantula-*/tasks/*.rake"])
Dont unpack it. Total waste of space and time... load it from the gem install location it like this
tarantula_path = Gem::required_location("tarantula", "")
if tarantula_path
Dir[ File.join(tarantula_path, "..","tasks","*.rake") ].each {
|rakefile| load rakefile
}
end
Subscribe to:
Posts (Atom)