Sha256: 1fb7fc35455fe5bf1769db65ed67ed13b94eed0c63ca4956c3ae229f66f54223

Contents?: true

Size: 1.33 KB

Versions: 2

Compression:

Stored size: 1.33 KB

Contents

require "helper"

class NamespacedControllerInstrumentationTest < ActionController::TestCase
  tests Admin::PostsController

  setup :setup_subscriber
  teardown :teardown_subscriber

  def setup_subscriber
    @subscriber = Nunes::Subscribers::ActionController.subscribe(adapter)
  end

  def teardown_subscriber
    ActiveSupport::Notifications.unsubscribe @subscriber if @subscriber
  end

  test "process_action" do
    get :index

    assert_response :success

    assert_timer "action_controller.controller.Admin.PostsController.index.runtime.total"
    assert_timer "action_controller.controller.Admin.PostsController.index.runtime.view"
    assert_timer "action_controller.controller.Admin.PostsController.index.runtime.db"

    assert_counter "action_controller.format.html"
    assert_counter "action_controller.status.200"

    assert_counter "action_controller.controller.Admin.PostsController.index.format.html"
    assert_counter "action_controller.controller.Admin.PostsController.index.status.200"
  end

  test "process_action w/ json" do
    get :index, format: :json

    assert_counter "action_controller.controller.Admin.PostsController.index.format.json"
  end

  test "process_action bad_request" do
    get :new

    assert_response :forbidden

    assert_counter "action_controller.controller.Admin.PostsController.new.status.403"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nunes-0.4.0 test/namespaced_controller_instrumentation_test.rb
nunes-0.3.1 test/namespaced_controller_instrumentation_test.rb