Sha256: 78b7b3c7f94e353d59fbb377462bc36f505c23e5b0a1c82e43708bbd9e7b311b

Contents?: true

Size: 634 Bytes

Versions: 3

Compression:

Stored size: 634 Bytes

Contents

# frozen_string_literal: true

require 'test_helper'

class BooksControllerTest < ActionController::TestCase
  setup do
    Book.delete_all
    @book = Book.create! title: 'Head First ActionArgs'
    get :show, params: {id: @book.id}
  end

  sub_test_case 'before_action' do
    test 'via Symbol' do
      assert_equal @book, assigns(:book)
    end

    if Rails.version < '5.1'
      test 'via String' do
        assert assigns(:string_filter_executed)
      end
    end

    test 'via Proc' do
      assert assigns(:proc_filter_executed)
    end
  end

  test 'around_action' do
    assert_not_nil assigns(:elapsed_time)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
action_args-2.5.0 test/controllers/hooks_test.rb
action_args-2.4.0 test/controllers/hooks_test.rb
action_args-2.3.2 test/controllers/hooks_test.rb