Sha256: 5f88571ee6ed9205be743ce2f266476c660454207ab25ed67239b6d319e74eaf

Contents?: true

Size: 874 Bytes

Versions: 5

Compression:

Stored size: 874 Bytes

Contents

# frozen_string_literal: true

RSpec.describe "DB / auto-registration", :app_integration do
  before do
    @env = ENV.to_h
    allow(Hanami::Env).to receive(:loaded?).and_return(false)
  end

  after do
    ENV.replace(@env)
  end

  it "does not auto-register files in entities/, structs/, or db/" do
    with_tmp_directory(@dir = Dir.mktmpdir) do
      write "config/app.rb", <<~RUBY
        require "hanami"

        module TestApp
          class App < Hanami::App
          end
        end
      RUBY

      write "app/db/changesets/update_posts.rb", ""
      write "app/entities/post.rb", ""
      write "app/structs/post.rb", ""

      ENV["DATABASE_URL"] = "sqlite::memory"

      require "hanami/boot"

      expect(Hanami.app.keys).not_to include(*[
        "db.changesets.update_posts",
        "entities.post",
        "structs.post"
      ])
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
hanami-2.2.1 spec/integration/db/auto_registration_spec.rb
hanami-2.2.0 spec/integration/db/auto_registration_spec.rb
hanami-2.2.0.rc1 spec/integration/db/auto_registration_spec.rb
hanami-2.2.0.beta2 spec/integration/db/auto_registration_spec.rb
hanami-2.2.0.beta1 spec/integration/db/auto_registration_spec.rb