Commit 363c5746 authored by Matija Čupić's avatar Matija Čupić

Raise error when trying to create second cluster

parent 7691e015
...@@ -5,7 +5,7 @@ module Clusters ...@@ -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 ...@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment