lib/heroku/api/mock/releases.rb in heroku-api-0.1.5 vs lib/heroku/api/mock/releases.rb in heroku-api-0.1.6
- old
+ new
@@ -1,11 +1,11 @@
module Heroku
class API
module Mock
# stub GET /apps/:app/releases
- Excon.stub(:expects => 200, :method => :get, :path => %r{^/apps/([^/]+)/releases} ) do |params|
+ Excon.stub(:expects => 200, :method => :get, :path => %r{^/apps/([^/]+)/releases$} ) do |params|
request_params, mock_data = parse_stub_params(params)
app, _ = request_params[:captures][:path]
with_mock_app(mock_data, app) do |app_data|
if get_mock_app_addon(mock_data, app, 'releases:basic')
{
@@ -25,20 +25,20 @@
end
end
end
# stub GET /apps/:app/releases/:release
- Excon.stub(:expects => 200, :method => :get, :path => %r{^/apps/([^/]+)/releases/([^/]+)} ) do |params|
+ Excon.stub(:expects => 200, :method => :get, :path => %r{^/apps/([^/]+)/releases/([^/]+)$} ) do |params|
request_params, mock_data = parse_stub_params(params)
app, release_name, _ = request_params[:captures][:path]
with_mock_app(mock_data, app) do |app_data|
if ['releases:basic', 'releases:advanced'].any? {|addon| get_mock_app_addon(mock_data, app, addon)}
releases = if get_mock_app_addon(mock_data, app, 'releases:basic')
mock_data[:releases][app][-2..-1]
elsif get_mock_app_addon(mock_data, app, 'releases:advanced')
mock_data[:releases][app]
end
- if (release_name == 'current' && release_data = releases.last) || releases.detect {|release| release['name'] == release_name}
+ if release_data = (release_name == 'current' && releases.last) || releases.detect {|release| release['name'] == release_name}
{
:body => Heroku::API::OkJson.encode(release_data),
:status => 200
}
else