1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/railties/test/generators/observer_generator_test.rb

28 lines
930 B
Ruby
Raw Normal View History

2009-06-25 05:24:35 -04:00
require 'generators/generators_test_helper'
require 'rails/generators/rails/observer/observer_generator'
2009-06-25 05:24:35 -04:00
class ObserverGeneratorTest < Rails::Generators::TestCase
include GeneratorsTestHelper
arguments %w(account)
2009-06-25 05:24:35 -04:00
2009-06-27 07:03:07 -04:00
def test_invokes_default_orm
2009-06-25 05:24:35 -04:00
run_generator
assert_file "app/models/account_observer.rb", /class AccountObserver < ActiveRecord::Observer/
end
2009-06-27 07:03:07 -04:00
def test_invokes_default_orm_with_class_path
2009-06-25 05:24:35 -04:00
run_generator ["admin/account"]
assert_file "app/models/admin/account_observer.rb", /class Admin::AccountObserver < ActiveRecord::Observer/
end
def test_invokes_default_test_framework
run_generator
2009-06-27 07:03:07 -04:00
assert_file "test/unit/account_observer_test.rb", /class AccountObserverTest < ActiveSupport::TestCase/
2009-06-25 05:24:35 -04:00
end
def test_logs_if_the_test_framework_cannot_be_found
content = run_generator ["account", "--test-framework=rspec"]
assert_match /rspec \[not found\]/, content
2009-06-25 05:24:35 -04:00
end
end