Raise error when trying to create second cluster
This commit is contained in:
parent
7691e015d7
commit
363c57468d
2 changed files with 2 additions and 2 deletions
|
@ -5,7 +5,7 @@ module Clusters
|
||||||
def execute(access_token)
|
def execute(access_token)
|
||||||
@access_token = access_token
|
@access_token = access_token
|
||||||
|
|
||||||
return unless can_create_cluster?
|
raise Exception.new('Instance does not support multiple clusters') unless can_create_cluster?
|
||||||
|
|
||||||
create_cluster.tap do |cluster|
|
create_cluster.tap do |cluster|
|
||||||
ClusterProvisionWorker.perform_async(cluster.id) if cluster.persisted?
|
ClusterProvisionWorker.perform_async(cluster.id) if cluster.persisted?
|
||||||
|
|
|
@ -83,7 +83,7 @@ describe Clusters::CreateService do
|
||||||
|
|
||||||
it 'does not create a cluster' do
|
it 'does not create a cluster' do
|
||||||
expect(ClusterProvisionWorker).not_to receive(:perform_async)
|
expect(ClusterProvisionWorker).not_to receive(:perform_async)
|
||||||
expect { result }.to change { Clusters::Cluster.count }.by(0)
|
expect { result }.to raise_error(Exception).and change { Clusters::Cluster.count }.by(0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue