Sha256: c9831d98d9640dfb5d2eec57742bb2c52e78e0b92453075b1051b51321ba167d

Contents?: true

Size: 765 Bytes

Versions: 4

Compression:

Stored size: 765 Bytes

Contents

require 'isolation/abstract_unit'
require 'rails-observers'

class ConfigurationTest < ActiveSupport::TestCase
  include ActiveSupport::Testing::Isolation

  def setup
    build_app
    boot_rails
    FileUtils.rm_rf("#{app_path}/config/environments")
  end

  def teardown
    teardown_app
  end

  test "config.active_record.observers" do
    add_to_config <<-RUBY
      config.active_record.observers = :foo_observer
    RUBY

    app_file 'app/models/foo.rb', <<-RUBY
      class Foo < ActiveRecord::Base
      end
    RUBY

    app_file 'app/models/foo_observer.rb', <<-RUBY
      class FooObserver < ActiveRecord::Observer
      end
    RUBY

    require "#{app_path}/config/environment"

    _ = ActiveRecord::Base
    assert defined?(FooObserver)
  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/configuration_test.rb
rails-observers-0.1.2 test/configuration_test.rb
rails-observers-0.1.1 test/configuration_test.rb
rails-observers-0.1.0 test/configuration_test.rb