public
Description: Simplifies plugin testing by creating an isolated Rails environment that simulates its usage in a real application
Homepage: http://www.pluginaweek.org
Clone URL: git://github.com/pluginaweek/plugin_test_helper.git
obrie (author)
Tue Jul 01 21:52:04 -0700 2008
commit  fe2ec39a4c204d51617613d218f63974f8a8d85c
tree    862301d1e8f07a7f85fedeeaf961f0dfe73006bd
parent  40ebd62c3e17ab9588c8864ebc3fc030b13a5f3d
plugin_test_helper / test / functional / plugin_test_helper_generator_test.rb
100644 22 lines (17 sloc) 0.692 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
 
class PluginTestHelperGeneratorTest < Test::Unit::TestCase
  def setup
    setup_app('empty')
    
    require 'rails_generator'
    require 'rails_generator/scripts/generate'
    Rails::Generator::Base.sources << Rails::Generator::PathSource.new(:plugin_test_helper, "#{Rails.root}/../../generators")
    Rails::Generator::Scripts::Generate.new.run(['plugin_test_helper', 'acts_as_foo'])
  end
  
  def test_should_create_test_helper
    assert File.exists?("#{Rails.root}/vendor/plugins/acts_as_foo/test/test_helper.rb")
  end
  
  def teardown
    teardown_app
    FileUtils.rm_r(Dir.glob('test/app_root/*'))
  end
end