Sha256: 47aac3c51613e208b101da8b28a013736555200a5b91fe01d4955ef99993fb06

Contents?: true

Size: 1023 Bytes

Versions: 5

Compression:

Stored size: 1023 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../test_helper')

class PluginTestModelGeneratorTest < 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_model, "#{Rails.root}/../../generators")
    Rails::Generator::Scripts::Generate.new.run(['plugin_test_model', 'acts_as_foo', 'bar'])
  end
  
  def test_should_create_model
    assert File.exists?("#{Rails.root}/vendor/plugins/acts_as_foo/test/app_root/app/models/bar.rb")
  end
  
  def test_should_create_migration
    migration_path = Dir["#{Rails.root}/vendor/plugins/acts_as_foo/test/app_root/db/migrate/*"].first
    assert_not_nil migration_path
    assert_match /^.*_create_bars.rb$/, migration_path
  end
  
  def test_should_create_fixtures
    assert File.exists?("#{Rails.root}/vendor/plugins/acts_as_foo/test/fixtures/bars.yml")
  end
  
  def teardown
    teardown_app
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
plugin_test_helper-0.3.1 test/functional/plugin_test_model_generator_test.rb
plugin_test_helper-0.3.0 test/functional/plugin_test_model_generator_test.rb
plugin_test_helper-0.1.6 test/functional/plugin_test_model_generator_test.rb
plugin_test_helper-0.2.0 test/functional/plugin_test_model_generator_test.rb
plugin_test_helper-0.2.1 test/functional/plugin_test_model_generator_test.rb