Sha256: 97430098e90b2988f0af382f499f3ef13a8e5fac5c6fb73400c8e04657e74f60
Contents?: true
Size: 1.94 KB
Versions: 4
Compression:
Stored size: 1.94 KB
Contents
describe RabbitMQ::Definition::Create do let(:client) do double("client", :create_vhost => true, :update_permissions_of => true, :endpoint => ENV['RABBITMQ_MANAGEMENT_URL'] ) end before { allow(RabbitMQ::Definition::Dump).to receive(:run).and_return(true) } context "when a definition file does already exist" do before { allow(RabbitMQ::Definition::FileDefinition).to receive(:exists?).and_return(true) } it "notifies about error when a definition file already exists" do expect(RabbitMQ::Definition::Logger).to receive(:error).with("Definition file already exists in ./db/rabbitmq_definition.json").once described_class.run(client, false, ["/"]) end it "does NOT save the schema" do expect_any_instance_of(RabbitMQ::Definition::FileDefinition).not_to receive(:save) described_class.run(client, false, ["/"]) end end context "when a definition file does NOT exist" do before { allow(RabbitMQ::Definition::FileDefinition).to receive(:exists?).and_return(false) } it "notifies progress on each vhost when verobse" do expect(RabbitMQ::Definition::Logger).to receive(:progress).with("Creating vhost '/'").once described_class.run(client, true, ["/"]) end it "creates each vhost" do expect(client).to receive(:create_vhost).with('/').once described_class.run(client, false, ["/"]) end it "adds permission for the current user to each vhost" do expect(client).to receive(:update_permissions_of) .with( '/', 'guest', { :configure => ".*", :write => ".*", :read => ".*" } ).once described_class.run(client, false, ["/"]) end it "dumps the created hosts definitions" do expect(RabbitMQ::Definition::Dump).to receive(:run) .with(client, false, ["/"]) described_class.run(client, false, ["/"]) end end end
Version data entries
4 entries across 4 versions & 1 rubygems