From 53ef1de4fcdc7ea0f94ae8fe73f9a2b46e376223 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Thu, 30 Mar 2017 10:41:45 +0200 Subject: Fix production admin fixture to use the new `Users::CreateService` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- spec/services/users/create_service_spec.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'spec/services') diff --git a/spec/services/users/create_service_spec.rb b/spec/services/users/create_service_spec.rb index 5f79203701a..66f68650f81 100644 --- a/spec/services/users/create_service_spec.rb +++ b/spec/services/users/create_service_spec.rb @@ -61,6 +61,23 @@ describe Users::CreateService, services: true do ) end + context 'when the current_user is not persisted' do + let(:admin_user) { build(:admin) } + + it 'persists the given attributes and sets created_by_id to nil' do + user = service.execute + user.reload + + expect(user).to have_attributes( + name: params[:name], + username: params[:username], + email: params[:email], + password: params[:password], + created_by_id: nil + ) + end + end + it 'user is not confirmed if skip_confirmation param is not present' do expect(service.execute).not_to be_confirmed end -- cgit v1.2.3