Sha256: 620483a1348aa6ab13ed223d878e04a5f67ddb6624d229741d90920269e42bdc

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

require 'generators/generators_test_helper'
require 'generators/rails/observer/observer_generator'

class NamespacedObserverGeneratorTest < Rails::Generators::TestCase
  tests Rails::Generators::ObserverGenerator
  arguments %w(account)
  destination File.expand_path("../../tmp", __FILE__)

  def setup
    super
    prepare_destination
    Rails::Generators.namespace = TestApp
  end

  def teardown
    super
    Rails::Generators.namespace = nil
  end

  def test_invokes_default_orm
    run_generator
    assert_file "app/models/test_app/account_observer.rb", /module TestApp/, /  class AccountObserver < ActiveRecord::Observer/
  end

  def test_invokes_default_orm_with_class_path
    run_generator ["admin/account"]
    assert_file "app/models/test_app/admin/account_observer.rb", /module TestApp/, /  class Admin::AccountObserver < ActiveRecord::Observer/
  end

  def test_invokes_default_test_framework
    run_generator
    assert_file "test/unit/test_app/account_observer_test.rb", /module TestApp/, /  class AccountObserverTest < ActiveSupport::TestCase/
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/rails-observers-0.1.2/test/generators/namespaced_generators_test.rb
rails-observers-0.1.2 test/generators/namespaced_generators_test.rb
rails-observers-0.1.1 test/generators/namespaced_generators_test.rb
rails-observers-0.1.0 test/generators/namespaced_generators_test.rb