Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

rake task to test a set of rails applications

  • Loading branch information...
commit 1a1775384069ea29705bd7da2ac80016d5ad5793 1 parent d7376fa
Mike Dalessio flavorjones authored
1  .gitignore
View
@@ -1,3 +1,4 @@
*~
doc
pkg
+tmp
24 Rakefile
View
@@ -14,3 +14,27 @@ Hoe.spec "loofah" do
extra_deps << ["nokogiri", ">= 1.3.3"]
end
+
+task :fake_install => [:gem] do
+ FileUtils.mkdir_p "tmp"
+ system "mkdir -p tmp"
+ system "gem install pkg/loofah-0.2.2.gem -i tmp --no-ri --no-rdoc"
+ system "chmod -R go-w tmp"
+end
+
+def run(cmd)
+ puts "* running: #{cmd}"
+ system cmd
+ raise "ERROR running command" unless $! == 0
+end
+
+task :rails_test => [:fake_install] do
+ Dir.chdir("rails_tests") do
+ Dir["rails-*"].sort.each do |rails|
+ Dir.chdir rails do
+ ENV['GEM_HOME'] = File.expand_path("../../tmp")
+ run "rake db:create db:migrate db:test:prepare test"
+ end
+ end
+ end
+end
10 rails_tests/common/ar_scrub/test/unit/posts_test.rb
View
@@ -0,0 +1,10 @@
+require File.join(File.dirname(__FILE__), "../test_helper")
+
+class PostsTest < ActiveSupport::TestCase
+ def test_loofah_scrubbing
+ post = Post.new :title => "<script>yo dawg</script>", :body => "<script>omgwtfbbq</script>"
+ post.save!
+ assert_equal "<script>yo dawg</script>", post.title
+ assert_equal "omgwtfbbq", post.body
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.