Sha256: 0928bf7c16cee482d46622a1942f24d5ee7c8336dae73a1ab6b5c3607e51f25d

Contents?: true

Size: 1.04 KB

Versions: 5

Compression:

Stored size: 1.04 KB

Contents

require "spec_helper"
require "fog/brightbox/models/compute/database_server"

describe Brightbox::DatabaseServer do

  describe "#maintenance_window" do
    let(:fog_model) { Fog::Brightbox::Compute::DatabaseServer.new(fog_settings) }
    let(:dbs) { Brightbox::DatabaseServer.new(fog_model) }

    context "when default values" do
      let(:fog_settings) do
        {
          "maintenance_weekday" => 0,
          "maintenance_hour" => 6
        }
      end

      it "returns 'Sunday 06:00 UTC'" do
        expect(dbs.maintenance_window).to eql("Sunday 06:00 UTC")
      end
    end

    context "when non standard values" do
      let(:fog_settings) do
        {
          "maintenance_weekday" => 6,
          "maintenance_hour" => 23
        }
      end

      it "returns 'Saturday 23:00 UTC'" do
        expect(dbs.maintenance_window).to eql("Saturday 23:00 UTC")
      end
    end

    context "when not initialised" do
      let(:fog_settings) { {} }

      it "returns nil" do
        expect(dbs.maintenance_window).to be_nil
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
brightbox-cli-3.3.0 spec/unit/brightbox/database_server/maintenance_window_spec.rb
brightbox-cli-3.2.0 spec/unit/brightbox/database_server/maintenance_window_spec.rb
brightbox-cli-3.1.0 spec/unit/brightbox/database_server/maintenance_window_spec.rb
brightbox-cli-3.0.1 spec/unit/brightbox/database_server/maintenance_window_spec.rb
brightbox-cli-3.0.0 spec/unit/brightbox/database_server/maintenance_window_spec.rb