lib/heroku/api/mock/apps.rb in heroku-api-0.1.0 vs lib/heroku/api/mock/apps.rb in heroku-api-0.1.1

- 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::OkJson.encode({}), + :body => Heroku::API::Mock.json_gzip({}), :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::OkJson.encode(mock_data[:apps]), + :body => Heroku::API::Mock.json_gzip(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::OkJson.encode(app_data), + :body => Heroku::API::Mock.json_gzip(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::OkJson.encode('error' => 'Name is already taken'), + :body => Heroku::API::Mock.json_gzip('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 = { @@ -59,11 +59,11 @@ 'create_status' => 'complete', 'id' => rand(99999), 'name' => app, 'owner_email' => 'email@example.com', 'slug_size' => nil, - 'stack' => request_params[:query].has_key?('app[stack]') && request_params[:query]['app[stack]'] || 'bamboo-mri-1.9.2', + 'stack' => stack, 'requested_stack' => nil, 'git_url' => "git@heroku.com:#{app}.git", 'repo_migrate_status' => 'complete', 'repo_size' => nil, 'dynos' => 0, @@ -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::OkJson.encode(app_data), + :body => Heroku::API::Mock.json_gzip(app_data), :status => 202 } end end @@ -152,16 +152,16 @@ app_data['owner_email'] = email end end if email && !collaborator { - :body => Heroku::API::OkJson.encode('error' => 'Only existing collaborators can receive ownership for an app'), + :body => Heroku::API::Mock.json_gzip('error' => 'Only existing collaborators can receive ownership for an app'), :status => 422 } else { - :body => Heroku::API::OkJson.encode('name' => app_data['name']), + :body => Heroku::API::Mock.json_gzip('name' => app_data['name']), :status => 200 } end end end @@ -171,10 +171,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::OkJson.encode({}), + :body => Heroku::API::Mock.json_gzip({}), :status => 201 } end end