Sha256: 85fe134dc0f806fee10844b1fa4f37029e3d08f112980617e1ed18f73fdd76db

Contents?: true

Size: 633 Bytes

Versions: 4

Compression:

Stored size: 633 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

4 entries across 4 versions & 1 rubygems

Version Path
action_args-2.3.1 test/controllers/hooks_test.rb
action_args-2.3.0 test/controllers/hooks_test.rb
action_args-2.2.1 test/controllers/hooks_test.rb
action_args-2.2.0 test/controllers/hooks_test.rb