Rails::Generators::TestCase

class Rails::Generators::TestCase

Parent:
ActiveSupport::TestCase
Included modules:
Rails::Generators::Testing::Behaviour, Rails::Generators::Testing::SetupAndTeardown, Rails::Generators::Testing::Assertions

This class provides a TestCase for testing generators. To setup, you need just to configure the destination and set which generator is being tested:

class AppGeneratorTest < Rails::Generators::TestCase
  tests AppGenerator
  destination File.expand_path("../tmp", File.dirname(__FILE__))
end

If you want to ensure your destination root is clean before running each test, you can set a setup callback:

class AppGeneratorTest < Rails::Generators::TestCase
  tests AppGenerator
  destination File.expand_path("../tmp", File.dirname(__FILE__))
  setup :prepare_destination
end

© 2004–2016 David Heinemeier Hansson
Licensed under the MIT License.

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部