spec/controllers/users_controller_spec.rb in symphonia-3.0.3 vs spec/controllers/users_controller_spec.rb in symphonia-3.1.0
- old
+ new
@@ -1,6 +1,7 @@
-# require_relative '../spec_helper.rb'
+# frozen_string_literal: true
+
module Symphonia
describe UsersController, type: 'controller' do
routes { Symphonia::Engine.routes }
subject { Symphonia::User }
@@ -11,25 +12,25 @@
include_examples 'a controller actions', :user
context 'not found' do
it '#show' do
- get :show, params: {id: 0 }
+ 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(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::DeliveryJob).to have_been_enqueued
+ 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