Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Copying and fixing the HAML test helper

  • Loading branch information...
commit 3ef8d746b445f47859d705c268738c77883d4f0b 1 parent 6aaff8a
Kurtis Rainbolt-Greene authored
Showing with 10 additions and 4 deletions.
  1. +10 −4 test/test_helper.rb
View
14 test/test_helper.rb
@@ -1,4 +1,3 @@
-require 'rubygems'
require 'test/unit'
require 'rails/all'
require 'rails/generators'
@@ -16,9 +15,7 @@ def self.root
end
Rails.application.config.root = Rails.root
-Rails::Generators.configure!
-
-Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
+Dir[File.join File.dirname(__FILE__), 'support', '**', '*.rb'].each {|f| require f}
def copy_routes
routes = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', 'routes.rb'))
@@ -27,6 +24,15 @@ def copy_routes
FileUtils.cp File.expand_path(routes), destination
end
+# Asserts the given class exists in the given content. When a block is given,
+# it yields the content of the class.
+#
+# assert_file "test/functional/accounts_controller_test.rb" do |controller_test|
+# assert_class "AccountsControllerTest", controller_test do |klass|
+# assert_match /context "index action"/, klass
+# end
+# end
+#
def assert_class(klass, content)
assert content =~ /class #{klass}(\(.+\))?(.*?)\nend/m, "Expected to have class #{klass}"
yield $2.strip if block_given?
Please sign in to comment.
Something went wrong with that request. Please try again.