lib/heroku/api/mock/apps.rb in heroku-api-0.2.13 vs lib/heroku/api/mock/apps.rb in heroku-api-0.3.0

- old
+ new

@@ -40,9 +40,23 @@ :status => 200 } end end + # stub GET /apps/:app/server/maintenance + Excon.stub(:expects => 200, :method => :get, :path => %r{^/apps/([^/]+)/server/maintenance$}) do |params| + request_params, mock_data = parse_stub_params(params) + app, _ = request_params[:captures][:path].first + + with_mock_app(mock_data, app) do + maintenance = mock_data[:maintenance_mode].include?(app) + { + :body => Heroku::API::OkJson.encode('maintenance' => maintenance), + :status => 200 + } + end + end + # stub POST /apps Excon.stub(:expects => 202, :method => :post, :path => '/apps') do |params| 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)}"