Sha256: 1a6175aa75d239642208a84d92efbf972a03005e3f1fd34a4952663a90107a48

Contents?: true

Size: 816 Bytes

Versions: 8

Compression:

Stored size: 816 Bytes

Contents

module MiniTestSpecRails
  module SharedTestCaseBehavior
    extend ActiveSupport::Concern

    included do
      before           { setup_dummy_schema }
      let(:app)        { Dummy::Application }
      let(:user_ken)   { User.create! email: 'ken@metaskills.net' }
      let(:user_post)  { Post.create! title: 'Test Title', body: 'Test body. Test body.', user: user_ken }
    end

    private

    def rails5?
      Rails.version >= '5.0'
    end

    def setup_dummy_schema
      ActiveRecord::Base.class_eval do
        connection.instance_eval do
          create_table :users, force: true do |t|
            t.string :email
          end
          create_table :posts, force: true do |t|
            t.string  :title, :body
            t.integer :user_id
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
minitest-spec-rails-6.2.0 test/support/shared_test_case_behavior.rb
minitest-spec-rails-6.1.0 test/support/shared_test_case_behavior.rb
minitest-spec-rails-6.0.4 test/support/shared_test_case_behavior.rb
minitest-spec-rails-6.0.3 test/support/shared_test_case_behavior.rb
minitest-spec-rails-6.0.2 test/support/shared_test_case_behavior.rb
minitest-spec-rails-6.0.1 test/support/shared_test_case_behavior.rb
minitest-spec-rails-6.0.0 test/support/shared_test_case_behavior.rb
minitest-spec-rails-5.5.0 test/support/shared_test_case_behavior.rb