Sha256: 5a32af3f03501cf169851835f6d97ca2067035d43e01d530d4d848346a72b502

Contents?: true

Size: 1.34 KB

Versions: 11

Compression:

Stored size: 1.34 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 not logged in' do
    #   before do
    #     access_anonymous
    #     get :show, division: 'in'
    #   end
    #   it_should_behave_like 'a redirect with error', '/users/sign_in', 'You must sign in or sign up to continue.'
    # end

    describe 'when neither sending nor receiving is allowed' do
      before do
        login_user third_user
        get :show, 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, 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, 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

11 entries across 11 versions & 1 rubygems

Version Path
message_train-0.5.2 spec/controllers/message_train/concerns_spec.rb
message_train-0.5.1 spec/controllers/message_train/concerns_spec.rb
message_train-0.5.0 spec/controllers/message_train/concerns_spec.rb
message_train-0.4.6 spec/controllers/message_train/concerns_spec.rb
message_train-0.4.5 spec/controllers/message_train/concerns_spec.rb
message_train-0.4.4 spec/controllers/message_train/concerns_spec.rb
message_train-0.4.3 spec/controllers/message_train/concerns_spec.rb
message_train-0.4.2 spec/controllers/message_train/concerns_spec.rb
message_train-0.4.1 spec/controllers/message_train/concerns_spec.rb
message_train-0.4.0 spec/controllers/message_train/concerns_spec.rb
message_train-0.3.1 spec/controllers/message_train/concerns_spec.rb