lib/heroku/api/mock/apps.rb in heroku-api-0.2.7 vs lib/heroku/api/mock/apps.rb in heroku-api-0.2.8
- old
+ new
@@ -13,32 +13,32 @@
mock_data[:config_vars].delete(app)
mock_data[:domains].delete(app)
mock_data[:ps].delete(app)
mock_data[:releases].delete(app)
{
- :body => Heroku::API.json_encode({}),
+ :body => Heroku::API::OkJson.encode({}),
:status => 200
}
end
end
# stub GET /apps/
Excon.stub(:expects => 200, :method => :get, :path => '/apps') do |params|
request_params, mock_data = parse_stub_params(params)
{
- :body => Heroku::API.json_encode(mock_data[:apps]),
+ :body => Heroku::API::OkJson.encode(mock_data[:apps]),
:status => 200
}
end
# stub GET /apps/:app
Excon.stub(:expects => 200, :method => :get, :path => %r{^/apps/([^/]+)$} ) do |params|
request_params, mock_data = parse_stub_params(params)
app, _ = request_params[:captures][:path]
with_mock_app(mock_data, app) do |app_data|
{
- :body => Heroku::API.json_encode(app_data),
+ :body => Heroku::API::OkJson.encode(app_data),
:status => 200
}
end
end
@@ -47,11 +47,11 @@
request_params, mock_data = parse_stub_params(params)
app = request_params[:query].has_key?('app[name]') && request_params[:query]['app[name]'] || "generated-name-#{rand(999)}"
if get_mock_app(mock_data, app)
{
- :body => Heroku::API.json_encode('error' => 'Name is already taken'),
+ :body => Heroku::API::OkJson.encode('error' => 'Name is already taken'),
:status => 422
}
else
stack = request_params[:query].has_key?('app[stack]') && request_params[:query]['app[stack]'] || 'bamboo-mri-1.9.2'
app_data = {
@@ -110,11 +110,11 @@
mock_data[:ps][app].first['command'] = 'thin -p $PORT -e $RACK_ENV -R $HEROKU_RACK start'
mock_data[:ps][app].first['type'] = 'Dyno'
end
{
- :body => Heroku::API.json_encode(app_data),
+ :body => Heroku::API::OkJson.encode(app_data),
:status => 202
}
end
end
@@ -155,16 +155,16 @@
app_data['owner_email'] = email
end
end
if email && !collaborator
{
- :body => Heroku::API.json_encode('error' => 'Only existing collaborators can receive ownership for an app'),
+ :body => Heroku::API::OkJson.encode('error' => 'Only existing collaborators can receive ownership for an app'),
:status => 422
}
else
{
- :body => Heroku::API.json_encode('name' => app_data['name']),
+ :body => Heroku::API::OkJson.encode('name' => app_data['name']),
:status => 200
}
end
end
end
@@ -174,10 +174,10 @@
request_params, mock_data = parse_stub_params(params)
app, _ = request_params[:captures][:path]
with_mock_app(mock_data, app) do |app_data|
{
- :body => Heroku::API.json_encode({}),
+ :body => Heroku::API::OkJson.encode({}),
:status => 201
}
end
end