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
plugin_test_helper / test / functional / plugin_test_console_generator_test.rb
100644 22 lines (17 sloc) 0.686 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 PluginTestConsoleGeneratorTest < 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_console, "#{Rails.root}/../../generators")
    Rails::Generator::Scripts::Generate.new.run(['plugin_test_console', 'acts_as_foo'])
  end
  
  def test_should_create_console
    assert File.exists?("#{Rails.root}/vendor/plugins/acts_as_foo/script/console")
  end
  
  def teardown
    teardown_app
    FileUtils.rm_r(Dir.glob('test/app_root/*'))
  end
end