Sha256: 34fa4ee583cfb9ba2e4f1ec01cfa2fae958ad8e7c4823d88db341fdcf7138ed0

Contents?: true

Size: 1.35 KB

Versions: 1

Compression:

Stored size: 1.35 KB

Contents

require 'test_helper'

module ClarkKent
  class ReportsControllerTest < ActionController::TestCase
    setup do
      @report = reports(:one)
    end

    test "should get index" do
      get :index
      assert_response :success
      assert_not_nil assigns(:reports)
    end

    test "should get new" do
      get :new
      assert_response :success
    end

    test "should create report" do
      assert_difference('Report.count') do
        post :create, report: { name: @report.name, resource_type: @report.resource_type, sharing_scope_id: @report.sharing_scope_id, sharing_scope_type: @report.sharing_scope_type }
      end

      assert_redirected_to report_path(assigns(:report))
    end

    test "should show report" do
      get :show, id: @report
      assert_response :success
    end

    test "should get edit" do
      get :edit, id: @report
      assert_response :success
    end

    test "should update report" do
      patch :update, id: @report, report: { name: @report.name, resource_type: @report.resource_type, sharing_scope_id: @report.sharing_scope_id, sharing_scope_type: @report.sharing_scope_type }
      assert_redirected_to report_path(assigns(:report))
    end

    test "should destroy report" do
      assert_difference('Report.count', -1) do
        delete :destroy, id: @report
      end

      assert_redirected_to reports_path
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
clark_kent-0.0.1 test/controllers/clark_kent/reports_controller_test.rb