Sha256: 5efb1397b91e216d9354088cb684c5cd249f266632130396622e830350dfd100

Contents?: true

Size: 1.2 KB

Versions: 107

Compression:

Stored size: 1.2 KB

Contents

module CcApiStub
  module Spaces
    extend Helper

    class << self
      def succeed_to_load(options={})
        response_body = Helper.load_fixtures(options.delete(:fixture) || "fake_cc_#{object_name}", options)
        stub_get(object_endpoint, {}, response(200, response_body))
      end

      def succeed_to_create
        response_body = Helper.load_fixtures("fake_cc_created_space")
        stub_post(collection_endpoint, {}, response(201, response_body))
      end

      def summary_fixture
        Helper.load_fixtures("fake_cc_space_summary")
      end

      def succeed_to_load_summary(options={})
        response_body = summary_fixture
        response_body["services"] = [] if options.delete(:no_services)
        stub_get(%r{/v2/spaces/[^/]+/summary$}, {}, response(200, response_body))
      end

      def space_fixture_hash
        {
          :metadata => {
            :guid => "space-id-1",
            :url => "/v2/spaces/space-id-1"
          },
          :entity => {
            :name => "space-name-1"
          }
        }
      end

      private

      def collection_endpoint
        %r{/v2/spaces$}
      end

      def object_endpoint
        %r{/v2/spaces/[^/]+$}
      end
    end
  end
end

Version data entries

107 entries across 107 versions & 3 rubygems

Version Path
cloulu-0.1.6 lib/cc_api_stub/spaces.rb
cloulu-0.1.5 lib/cc_api_stub/spaces.rb
cfoundry-4.0.4.rc2 lib/cc_api_stub/spaces.rb
cfoundry-4.0.4.rc1 lib/cc_api_stub/spaces.rb
cfoundry-4.0.3 lib/cc_api_stub/spaces.rb
cfoundry-4.0.2.rc5 lib/cc_api_stub/spaces.rb
cfoundry-4.0.2.rc4 lib/cc_api_stub/spaces.rb
cfoundry-4.0.2.rc3 lib/cc_api_stub/spaces.rb
cfoundry-4.0.2.rc2 lib/cc_api_stub/spaces.rb
cfoundry-4.0.2.rc1 lib/cc_api_stub/spaces.rb
cfoundry-4.0.1 lib/cc_api_stub/spaces.rb
cfoundry-4.0.0 lib/cc_api_stub/spaces.rb
cfoundry-3.0.1 lib/cc_api_stub/spaces.rb
cloulu-0.1.2 lib/cc_api_stub/spaces.rb
cloulu-0.1.1 lib/cc_api_stub/spaces.rb
cfoundry-3.0.0 lib/cc_api_stub/spaces.rb
cfoundry-2.4.1.rc1 lib/cc_api_stub/spaces.rb
cfoundry-2.4.0 lib/cc_api_stub/spaces.rb
cfoundry-2.3.7.rc1 lib/cc_api_stub/spaces.rb
cfoundry-2.3.6 lib/cc_api_stub/spaces.rb