Module: CcApiStub::Spaces

Extended by:
Helper
Defined in:
lib/cc_api_stub/spaces.rb

Class Method Summary collapse

Methods included from Helper

fail_request, fail_to_load, fail_to_load_many, fail_with_error, find_fixture, fixture_prefix, host, host=, load_fixtures, object_class, object_name, response, response, stub_delete, stub_get, stub_post, stub_put, stub_request, succeed_to_create, succeed_to_delete, succeed_to_load, succeed_to_load_empty, succeed_to_load_many, succeed_to_update

Class Method Details

.space_fixture_hashObject



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/cc_api_stub/spaces.rb', line 26

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

.succeed_to_createObject



11
12
13
14
# File 'lib/cc_api_stub/spaces.rb', line 11

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

.succeed_to_load(options = {}) ⇒ Object



6
7
8
9
# File 'lib/cc_api_stub/spaces.rb', line 6

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

.succeed_to_load_summary(options = {}) ⇒ Object



20
21
22
23
24
# File 'lib/cc_api_stub/spaces.rb', line 20

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

.summary_fixtureObject



16
17
18
# File 'lib/cc_api_stub/spaces.rb', line 16

def summary_fixture
  Helper.load_fixtures("fake_cc_space_summary")
end