Sha256: da4f225e97c922d56e1ab13d8569eea20e289074944c0479790a1106d97581a8

Contents?: true

Size: 896 Bytes

Versions: 5

Compression:

Stored size: 896 Bytes

Contents

require 'rails_helper'

RSpec.describe WithdrawsController, type: :controller do
  fixtures :all

  describe 'GET #show' do
    before do
      @withdraw = FactoryBot.create(:withdraw)
    end

    describe 'When logged in as Librarian' do
      login_fixture_librarian
      it 'should show withdrawn item' do
        get :show, params: { id: @withdraw.to_param }
        response.should be_successful
      end
    end

    describe 'When logged in as User' do
      login_fixture_user
      it 'should show withdrawn item' do
        get :show, params: { id: @withdraw.to_param }
        response.should be_forbidden
      end
    end

    describe 'When not logged in' do
      it 'should show withdrawn item' do
        item = FactoryBot.create(:item)
        get :show, params: { id: @withdraw.to_param }
        response.should redirect_to new_user_session_url
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
enju_library-0.4.0.rc.1 spec/controllers/items_controller_spec.rb
enju_library-0.4.0.beta.4 spec/controllers/items_controller_spec.rb
enju_library-0.4.0.beta.3 spec/controllers/items_controller_spec.rb
enju_library-0.4.0.beta.2 spec/controllers/items_controller_spec.rb
enju_library-0.4.0.beta.1 spec/controllers/items_controller_spec.rb