Sha256: 221aab131b43db736e40075560bfa0a1bb3cc914f0eb9737073eb1df1c5abd2b

Contents?: true

Size: 1.3 KB

Versions: 14

Compression:

Stored size: 1.3 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
        get :show, division: 'in'
      end
      it_should_behave_like 'a redirect with notice', '/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

14 entries across 14 versions & 1 rubygems

Version Path
message_train-0.3.0 spec/controllers/message_train/concerns_spec.rb
message_train-0.2.12 spec/controllers/message_train/concerns_spec.rb
message_train-0.2.11 spec/controllers/message_train/concerns_spec.rb
message_train-0.2.10 spec/controllers/message_train/concerns_spec.rb
message_train-0.2.9 spec/controllers/message_train/concerns_spec.rb
message_train-0.2.8 spec/controllers/message_train/concerns_spec.rb
message_train-0.2.7 spec/controllers/message_train/concerns_spec.rb
message_train-0.2.6 spec/controllers/message_train/concerns_spec.rb
message_train-0.2.5 spec/controllers/message_train/concerns_spec.rb
message_train-0.2.4 spec/controllers/message_train/concerns_spec.rb
message_train-0.2.3 spec/controllers/message_train/concerns_spec.rb
message_train-0.2.2 spec/controllers/message_train/concerns_spec.rb
message_train-0.2.1 spec/controllers/message_train/concerns_spec.rb
message_train-0.2.0 spec/controllers/message_train/concerns_spec.rb