Hound is love, Hound is life

This commit is contained in:
Luka Murn 2017-09-21 19:18:39 +02:00
parent a14457cba0
commit e0a6b1360d

View file

@ -3,11 +3,10 @@ require 'rails_helper'
include ClientApi::Teams include ClientApi::Teams
describe ClientApi::Teams::CreateService do describe ClientApi::Teams::CreateService do
let(:user) { create :user, email: 'user@asdf.com' } let(:user) { create :user, email: 'user@asdf.com' }
let(:team) { build :team, let(:team) do
name: 'My Team', build :team, name: 'My Team', description: 'My Description'
description: 'My Description' } end
it 'should raise a StandardError if current_user is not assigned' do it 'should raise a StandardError if current_user is not assigned' do
expect { CreateService.new }.to raise_error(StandardError) expect { CreateService.new }.to raise_error(StandardError)
@ -36,7 +35,8 @@ describe ClientApi::Teams::CreateService do
service = CreateService.new( service = CreateService.new(
current_user: user, current_user: user,
params: { description: team.description }) params: { description: team.description }
)
result = service.execute result = service.execute
expect(result[:status]).to eq :error expect(result[:status]).to eq :error
end end
@ -45,7 +45,8 @@ describe ClientApi::Teams::CreateService do
team.name = ('a' * (Constants::NAME_MIN_LENGTH - 1)).to_s team.name = ('a' * (Constants::NAME_MIN_LENGTH - 1)).to_s
service = CreateService.new( service = CreateService.new(
current_user: user, current_user: user,
params: { name: team.name, description: team.description }) params: { name: team.name, description: team.description }
)
result = service.execute result = service.execute
expect(result[:status]).to eq :error expect(result[:status]).to eq :error
end end
@ -54,7 +55,8 @@ describe ClientApi::Teams::CreateService do
team.name = ('a' * (Constants::NAME_MAX_LENGTH + 1)).to_s team.name = ('a' * (Constants::NAME_MAX_LENGTH + 1)).to_s
service = CreateService.new( service = CreateService.new(
current_user: user, current_user: user,
params: { name: team.name, description: team.description }) params: { name: team.name, description: team.description }
)
result = service.execute result = service.execute
expect(result[:status]).to eq :error expect(result[:status]).to eq :error
end end
@ -63,7 +65,8 @@ describe ClientApi::Teams::CreateService do
team.description = ('a' * (Constants::TEXT_MAX_LENGTH + 1)).to_s team.description = ('a' * (Constants::TEXT_MAX_LENGTH + 1)).to_s
service = CreateService.new( service = CreateService.new(
current_user: user, current_user: user,
params: { name: team.name, description: team.description }) params: { name: team.name, description: team.description }
)
result = service.execute result = service.execute
expect(result[:status]).to eq :error expect(result[:status]).to eq :error
end end