Sha256: d767284fb882b59141c09d6f3a81e545911f71911e9052d771f7d683474569f4

Contents?: true

Size: 1.41 KB

Versions: 5

Compression:

Stored size: 1.41 KB

Contents

require 'rails_helper'

describe MessageTrain::BoxesController do
  include_context 'loaded site'
  include ControllerMacros
  routes { MessageTrain::Engine.routes }

  describe 'GET #show' do
    describe 'when neither sending nor receiving is allowed' do
      before do
        login_user third_user
        get(
          :show,
          params: {
            division: 'in',
            collective_id: 'groups:first-group'
          }
        )
      end
      it_should_behave_like(
        'a redirect with error',
        '/',
        'Access to that box denied'
      )
    end

    describe 'when only sending is allowed' do
      before do
        login_user first_user
        get(
          :show,
          params: {
            division: 'in',
            collective_id: 'groups:first-group'
          }
        )
      end
      it_should_behave_like(
        'a redirect with error',
        '/collectives/groups:first-group/box/sent',
        'Access to that box denied'
      )
    end

    describe 'when only receiving is allowed' do
      before do
        login_user first_user
        get(
          :show,
          params: {
            division: 'sent',
            collective_id: 'groups:membered-group'
          }
        )
      end
      it_should_behave_like(
        'a redirect with error',
        '/collectives/groups:membered-group/box/in',
        'Access to that box denied'
      )
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
message_train-0.7.6 spec/controllers/message_train/concerns_spec.rb
message_train-0.7.5 spec/controllers/message_train/concerns_spec.rb
message_train-0.7.3 spec/controllers/message_train/concerns_spec.rb
message_train-0.7.2 spec/controllers/message_train/concerns_spec.rb
message_train-0.7.1 spec/controllers/message_train/concerns_spec.rb