Sha256: dc04c83cd56630d207bbb10eda2834cbc5757aafe2ed3769cb2267805a7dab4c

Contents?: true

Size: 773 Bytes

Versions: 62

Compression:

Stored size: 773 Bytes

Contents

require 'test_helper'

module Workarea
  module Admin
    class AuthorizationIntegrationTest < Workarea::IntegrationTest
      setup :set_user

      def set_user
        @user = create_user(admin: true, password: 'W3bl1nc!')
      end

      def test_allows_the_request_when_admin_user
        # login
        post storefront.login_path,
          params: { email: @user.email, password: 'W3bl1nc!' }

        get '/admin'
        assert(response.ok?)
      end

      def test_does_not_allow_the_request_when_non_admin_user
        # login
        @user.update_attributes!(admin: false)
        post storefront.login_path,
          params: { email: @user.email, password: 'W3bl1nc!' }

        get '/admin'
        assert(response.redirect?)
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-admin-3.5.27 test/integration/workarea/admin/authorization_integration_test.rb
workarea-admin-3.5.26 test/integration/workarea/admin/authorization_integration_test.rb
workarea-admin-3.4.45 test/integration/workarea/admin/authorization_integration_test.rb
workarea-admin-3.5.25 test/integration/workarea/admin/authorization_integration_test.rb
workarea-admin-3.5.23 test/integration/workarea/admin/authorization_integration_test.rb
workarea-admin-3.4.44 test/integration/workarea/admin/authorization_integration_test.rb
workarea-admin-3.5.22 test/integration/workarea/admin/authorization_integration_test.rb
workarea-admin-3.4.43 test/integration/workarea/admin/authorization_integration_test.rb
workarea-admin-3.5.21 test/integration/workarea/admin/authorization_integration_test.rb
workarea-admin-3.4.42 test/integration/workarea/admin/authorization_integration_test.rb
workarea-admin-3.5.20 test/integration/workarea/admin/authorization_integration_test.rb
workarea-admin-3.4.41 test/integration/workarea/admin/authorization_integration_test.rb
workarea-admin-3.5.19 test/integration/workarea/admin/authorization_integration_test.rb
workarea-admin-3.4.40 test/integration/workarea/admin/authorization_integration_test.rb
workarea-admin-3.5.18 test/integration/workarea/admin/authorization_integration_test.rb
workarea-admin-3.4.39 test/integration/workarea/admin/authorization_integration_test.rb
workarea-admin-3.5.17 test/integration/workarea/admin/authorization_integration_test.rb
workarea-admin-3.4.38 test/integration/workarea/admin/authorization_integration_test.rb
workarea-admin-3.5.16 test/integration/workarea/admin/authorization_integration_test.rb
workarea-admin-3.4.37 test/integration/workarea/admin/authorization_integration_test.rb