File: test_test.rb

package info (click to toggle)
rails 2%3A7.2.2.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 43,348 kB
  • sloc: ruby: 349,797; javascript: 30,703; yacc: 46; sql: 43; sh: 29; makefile: 27
file content (34 lines) | stat: -rw-r--r-- 935 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# frozen_string_literal: true

require "abstract_unit"
require "plugin_helpers"

class Rails::Engine::TestTest < ActiveSupport::TestCase
  include PluginHelpers

  setup do
    @destination_root = Dir.mktmpdir("bukkits")
    generate_plugin("#{@destination_root}/bukkits", "--mountable")
  end

  teardown do
    FileUtils.rm_rf(@destination_root)
  end

  test "automatically synchronize test schema" do
    in_plugin_context(plugin_path) do
      # In order to confirm that migration files are loaded, generate multiple migration files.
      `bin/rails generate model user name:string;
       bin/rails generate model todo name:string;
       RAILS_ENV=development bin/rails db:migrate`

      output = `bin/rails test test/models/bukkits/user_test.rb`
      assert_includes(output, "0 runs, 0 assertions, 0 failures, 0 errors, 0 skips")
    end
  end

  private
    def plugin_path
      "#{@destination_root}/bukkits"
    end
end