mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-03-04 03:36:44 +08:00
Hound is love, Hound is life
This commit is contained in:
parent
a14457cba0
commit
e0a6b1360d
1 changed files with 11 additions and 8 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue