Sha256: ec211d3358238328a0ec5bd3b34211f3c87c911931bc8ec4ba9e7fc98d53fd55

Contents?: true

Size: 1.99 KB

Versions: 10

Compression:

Stored size: 1.99 KB

Contents

require 'spec_helper'
require 'net/http'
require 'uri'

describe CcApiStub::Applications do
  describe ".succeed_to_load" do
    let(:url) { "http://example.com/v2/apps/234" }
    subject { CcApiStub::Applications.succeed_to_load }

    it_behaves_like "a stubbed get request"
  end

  describe ".succeed_to_create" do
    let(:url) { "http://example.com/v2/apps" }
    subject { CcApiStub::Applications.succeed_to_create }

    it_behaves_like "a stubbed post request"
  end

  describe ".succeed_to_update" do
    let(:url) { "http://example.com/v2/apps/234" }
    subject { CcApiStub::Applications.succeed_to_update }

    it_behaves_like "a stubbed put request"
  end

  describe ".succeed_to_map_route" do
    let(:url) { "http://example.com/v2/apps/234/routes/123" }
    subject { CcApiStub::Applications.succeed_to_map_route }

    it_behaves_like "a stubbed put request", :code => 201
  end

  describe ".succeed_to_load_stats" do
    let(:url) { "http://example.com/v2/apps/234/stats" }
    subject { CcApiStub::Applications.succeed_to_load_stats }

    it_behaves_like "a stubbed get request"
  end
  
  describe ".summary_fixture" do
    it "loads a fixture file" do
      expect(CcApiStub::Applications.summary_fixture).to be_a(Hash)
    end
  end

  describe "succeed_to_load_summary" do
    let(:url) { "http://example.com/v2/apps/234/summary" }

    context "with default args" do
      subject { CcApiStub::Applications.succeed_to_load_summary }

      it_behaves_like "a stubbed get request", :including_json => { "state" => "STARTED" }
    end

    context "with user set args" do
      subject { CcApiStub::Applications.succeed_to_load_summary(:state => "FLAPPING") }

      it_behaves_like "a stubbed get request", :including_json => { "state" => "FLAPPING" }
    end
  end

  describe ".succeed_to_load_service_bindings" do
    let(:url) { "http://example.com/v2/apps/234/service_bindings" }
    subject { CcApiStub::Applications.succeed_to_load_service_bindings }

    it_behaves_like "a stubbed get request"
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
new_cfoundry-4.9.4 spec/cc_api_stub/applications_spec.rb
new_cfoundry-4.9.3 spec/cc_api_stub/applications_spec.rb
ncfoundry-4.9.4 spec/cc_api_stub/applications_spec.rb
ncfoundry-4.9.3 spec/cc_api_stub/applications_spec.rb
ncfoundry-4.9.2 spec/cc_api_stub/applications_spec.rb
new_cfoundry-4.9.2 spec/cc_api_stub/applications_spec.rb
new_cfoundry-4.9.1 spec/cc_api_stub/applications_spec.rb
new_cfoundry-4.9.0 spec/cc_api_stub/applications_spec.rb
new_cfoundry-4.8.3 spec/cc_api_stub/applications_spec.rb
new_cfoundry-4.8.2 spec/cc_api_stub/applications_spec.rb