Sha256: ce0e84161d6f679eb941cc7665927ca897e70c146abaa7bfc376f9c7d5bc74cc
Contents?: true
Size: 1.21 KB
Versions: 31
Compression:
Stored size: 1.21 KB
Contents
# frozen_string_literal: true module Symphonia describe UsersController, type: 'controller' do routes { Symphonia::Engine.routes } subject { Symphonia::User } let(:user) { FactoryBot.create(:user) } context 'as admin', logged: :admin do include ActiveJob::TestHelper include_examples 'a controller actions', :user context 'not found' do it '#show' do get :show, params: { id: 0 } expect(response).to have_http_status :not_found end end it '#archive' do user.update_columns status: 'active' expect(post(:archive, params: { id: user })) expect(response).to redirect_to users_url expect(user.reload.status).to eq 'archived' end it '#unarchive' do user.update_columns status: 'archived' expect(post(:unarchive, params: { id: user })) expect(ActionMailer::MailDeliveryJob).to have_been_enqueued expect(response).to redirect_to users_url expect(user.reload.status).to eq 'active' end end context 'as regular use', logged: true do it '#index' do get :index expect(response).to have_http_status :forbidden end end end end
Version data entries
31 entries across 31 versions & 1 rubygems