test/helper.rb in padrino-gen-0.7.9 vs test/helper.rb in padrino-gen-0.8.0

- old
+ new

@@ -13,11 +13,12 @@ end end require 'padrino-gen' -Padrino::Generators::Cli.start +Padrino::Generators.setup! +Padrino::Generators.lockup! class Test::Unit::TestCase include Rack::Test::Methods include Webrat::Methods include Webrat::Matchers @@ -48,31 +49,30 @@ attributes.merge!(:count => 0) matcher = HaveSelector.new(name, attributes) raise "Please specify a block!" if html.blank? assert matcher.matches?(html), matcher.failure_message end - + # assert_file_exists('/tmp/app') def assert_file_exists(file_path) assert File.exist?(file_path), "File at path '#{file_path}' does not exist!" end - alias assert_dir_exists assert_file_exists - + alias :assert_dir_exists :assert_file_exists + # assert_no_file_exists('/tmp/app') def assert_no_file_exists(file_path) assert !File.exist?(file_path), "File should not exist at path '#{file_path}' but was found!" end - alias assert_no_dir_exists assert_no_file_exists + alias :assert_no_dir_exists :assert_no_file_exists # Asserts that a file matches the pattern def assert_match_in_file(pattern, file) File.exist?(file) ? assert_match(pattern, File.read(file)) : assert_file_exists(file) end - + def assert_no_match_in_file(pattern, file) File.exists?(file) ? !assert_match(pattern, File.read(file)) : assert_file_exists(file) end - end class Object # Silences the output by redirecting to stringIO # silence_logger { ...commands... } => "...output..." \ No newline at end of file