Sha256: f58270d4319f4276ee43beafd982b39de2dc27a1544b1dc9ffadfd7c30489381

Contents?: true

Size: 795 Bytes

Versions: 14

Compression:

Stored size: 795 Bytes

Contents

require "spec_helper"

describe Brightbox::Api, "#fog_model" do
  let(:fog_model) { Fog::Model.new }
  let(:identifier) { "api-12345" }

  before do
    allow(fog_model).to receive(:id).and_return(identifier)
    allow(fog_model).to receive(:attributes).and_return({})
  end

  context "when initialised with a fog model" do
    subject(:instance) { described_class.new(fog_model) }

    it "returns the object" do
      expect(instance.fog_model).to eql(fog_model)
    end
  end

  context "when initialised with an identifier string" do
    subject(:instance) { described_class.new(identifier) }

    it "attempts to find a resource" do
      expect(Brightbox::Api).to receive(:find).with(identifier).and_return(fog_model)

      expect(instance.fog_model).to eql(fog_model)
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
brightbox-cli-4.8.0 spec/unit/brightbox/api/fog_model_spec.rb
brightbox-cli-4.7.0 spec/unit/brightbox/api/fog_model_spec.rb
brightbox-cli-4.6.0 spec/unit/brightbox/api/fog_model_spec.rb
brightbox-cli-4.5.0 spec/unit/brightbox/api/fog_model_spec.rb
brightbox-cli-4.5.0.rc1 spec/unit/brightbox/api/fog_model_spec.rb
brightbox-cli-4.4.0 spec/unit/brightbox/api/fog_model_spec.rb
brightbox-cli-4.3.2 spec/unit/brightbox/api/fog_model_spec.rb
brightbox-cli-4.3.1 spec/unit/brightbox/api/fog_model_spec.rb
brightbox-cli-4.3.0 spec/unit/brightbox/api/fog_model_spec.rb
brightbox-cli-4.2.1 spec/unit/brightbox/api/fog_model_spec.rb
brightbox-cli-4.2.0 spec/unit/brightbox/api/fog_model_spec.rb
brightbox-cli-4.1.0 spec/unit/brightbox/api/fog_model_spec.rb
brightbox-cli-4.0.0 spec/unit/brightbox/api/fog_model_spec.rb
brightbox-cli-4.0.0.rc2 spec/unit/brightbox/api/fog_model_spec.rb