Sha256: 32ac1ce1a29d13cd63cc59f16358182c83058e1d38bbe0ed38e5d24bff0c172b

Contents?: true

Size: 721 Bytes

Versions: 5

Compression:

Stored size: 721 Bytes

Contents

require 'test_helper'

class AuditsControllerTest < ActionController::TestCase
  def test_index
    get :index, {}, set_session_user
    assert_template 'index'
  end

  def test_show
    get :show, {:id => Audit.first}, set_session_user
    assert_template 'show'
  end

  def setup_user
    @request.session[:user] = users(:one).id
    users(:one).roles       = [Role.find_by_name('Anonymous'), Role.find_by_name('Viewer')]
  end
  def user_with_viewer_rights_should_fail_to edit_audit
    setup_user
    get :edit, {:id => Audit.first.id}
    assert @response.status == '403 Forbidden'
  end

  def user_with_viewer_rights_succeed_in_viewing_audits
    setup_user
    get :index
    assert_response :success
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
foreman_discovery-1.0.0 test/foreman_app/test/functional/audits_controller_test.rb
foreman_discovery-1.0.0.rc4 test/foreman_app/test/functional/audits_controller_test.rb
foreman_discovery-1.0.0.rc3 test/foreman_app/test/functional/audits_controller_test.rb
foreman_discovery-1.0.0.rc2 test/foreman_app/test/functional/audits_controller_test.rb
foreman_discovery-1.0.0.rc1 test/foreman_app/test/functional/audits_controller_test.rb