Sha256: 3c610993b36ac5f7f2375225acc69f824c7dfd888fb5e3ecc8d48899cc75b97c

Contents?: true

Size: 1.38 KB

Versions: 20

Compression:

Stored size: 1.38 KB

Contents

require 'spec_helper'

describe F5::Icontrol::API do
  before do
    F5::Icontrol.configure do
    end
  end

  describe '#initialize' do
  end

  describe 'a non terminal object' do
    it "returns another version of itself" do
      expect(subject.LocalLB.class).to eq described_class
    end

    it "stores the path" do
      expect(subject.LocalLB.api_path).to eq "LocalLB"
    end
  end

  describe 'a terminal object' do
    it "returns another version of itself" do
      expect(subject.LocalLB.Pool.class).to eq described_class
    end

    it "stores the path" do
      expect(subject.LocalLB.Pool.api_path).to eq "LocalLB.Pool"
    end
  end

  describe 'a terminal object with a method' do
    let(:client) { double('SavonClient', operations: [ :get_list ]) }

    before do
      expect(Savon).to receive(:client).and_return(client)
      expect(client).to receive(:call).with(:get_list).and_return({get_list_response: { return: "foo" }})
    end

    it "calls the method" do
      subject.LocalLB.Pool.get_list
    end

    it "returns the inner contents" do
      expect(subject.LocalLB.Pool.get_list).to eq "foo"
    end
  end

  describe 'a non existent method' do
    it "raises on non terminal method" do
      expect { subject.foo }.to raise_error(NameError)
    end

    it "raises on terminal method" do
      expect { subject.LocalLB.Pool.foo }.to raise_error(NameError)
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
f5-icontrol-0.3.7 spec/models/api_spec.rb
f5-icontrol-0.3.6 spec/models/api_spec.rb
f5-icontrol-0.3.5 spec/models/api_spec.rb
f5-icontrol-0.3.3 spec/models/api_spec.rb
f5-icontrol-0.3.2 spec/models/api_spec.rb
f5-icontrol-0.3.1 spec/models/api_spec.rb
f5-icontrol-0.3.0 spec/models/api_spec.rb
f5-icontrol-0.2.7 spec/models/api_spec.rb
f5-icontrol-0.2.6 spec/models/api_spec.rb
f5-icontrol-0.2.5 spec/models/api_spec.rb
f5-icontrol-0.2.4 spec/models/api_spec.rb
f5-icontrol-0.2.3 spec/models/api_spec.rb
f5-icontrol-0.2.2 spec/models/api_spec.rb
f5-icontrol-0.2.1 spec/models/api_spec.rb
f5-icontrol-0.2.0 spec/models/api_spec.rb
f5-icontrol-0.1.6 spec/models/api_spec.rb
f5-icontrol-0.1.5 spec/models/api_spec.rb
f5-icontrol-0.1.4 spec/models/api_spec.rb
f5-icontrol-0.1.3 spec/models/api_spec.rb
f5-icontrol-0.1.2 spec/models/api_spec.rb