Sha256: 556022b0bbbb5f23514a24fd0f77855ae2675bea5f6da8d69eb847a2e8b0768d

Contents?: true

Size: 1.93 KB

Versions: 38

Compression:

Stored size: 1.93 KB

Contents

require "spec_helper"

describe "server_usage", :mock_only do
  let!(:client)      { create_client }
  let!(:account)     { create_account(client: client, account: { owner: create_user(client: client)}) }
  let!(:provider)    { create_provider(account: account) }
  let!(:database_service)    { create_database_service(provider: provider) }

  before(:each) do
    client.find(:database_server_usages, account.id).merge!(
      "2014-07" => [
        {
          "start_at"         => "2014-05-01T00:00:00+00:00",
          "end_at"           => "2014-05-31T23:59:59+00:00",
          "report_time"      => Time.now.iso8601,
          "provisioned_id"   => "e982somedb",
          "flavor"           => "db.r3.8xlarge",
          "multi_az"         => false,
          "master"           => false,
          "location"         => "us-east-1d",
          "database_service" => "https://api.engineyard.com/database_services/#{database_service.id}",
          "provider"         => "https://api.engineyard.com/providers/#{provider.id}",
        },
      ]
    )
  end

  it "can fetch usage for an account and billing_month" do
    database_server_usages = client.database_server_usages.all(account_id: account.id, billing_month: "2014-07")

    expect(database_server_usages.size).to eq(1)

    database_server_usage = database_server_usages.first

    expect(database_server_usage.start_at).not_to be_nil
    expect(database_server_usage.end_at).not_to be_nil
    expect(database_server_usage.report_time).not_to be_nil

    expect(database_server_usage.provisioned_id).to   eq("e982somedb")
    expect(database_server_usage.flavor).to   eq("db.r3.8xlarge")
    expect(database_server_usage.multi_az).to eq(false)
    expect(database_server_usage.master).to   eq(false)
    expect(database_server_usage.location).to eq("us-east-1d")

    expect(database_server_usage.database_service).to eq(database_service)
    expect(database_server_usage.provider).to    eq(provider)
  end

end

Version data entries

38 entries across 38 versions & 2 rubygems

Version Path
ey-core-3.6.4 spec/database_server_usage_spec.rb
ey-core-3.6.3 spec/database_server_usage_spec.rb
ey-core-3.6.1 spec/database_server_usage_spec.rb
groove-ey-core-3.6.3 spec/database_server_usage_spec.rb
groove-ey-core-3.6.2 spec/database_server_usage_spec.rb
groove-ey-core-3.6.1 spec/database_server_usage_spec.rb
ey-core-3.5.0 spec/database_server_usage_spec.rb
ey-core-3.4.4 spec/database_server_usage_spec.rb
ey-core-3.4.2 spec/database_server_usage_spec.rb
ey-core-3.4.1 spec/database_server_usage_spec.rb
ey-core-3.4.0 spec/database_server_usage_spec.rb
ey-core-3.3.1 spec/database_server_usage_spec.rb
ey-core-3.3.0 spec/database_server_usage_spec.rb
ey-core-3.2.6 spec/database_server_usage_spec.rb
ey-core-3.2.5 spec/database_server_usage_spec.rb
ey-core-3.2.4 spec/database_server_usage_spec.rb
ey-core-3.2.3 spec/database_server_usage_spec.rb
ey-core-3.2.2 spec/database_server_usage_spec.rb
ey-core-3.2.1 spec/database_server_usage_spec.rb
ey-core-3.2.0 spec/database_server_usage_spec.rb